0

DTL problem. Please help

Hello everyone I want to check if my dictionary item 'status' is empty in my django template. The dictionary in the views.py goes like this: context= { "name": username, "email": usermail, "status": status, } return render(request, "myapp/dataview.html", context)

23rd Aug 2021, 11:40 AM
Pukhrambam
Pukhrambam - avatar
2 Réponses
+ 1
{% if status %} {# Your work #} {% else %} {# status was blank #} {% endif %} In Python, blank variables return "False"
23rd Aug 2021, 11:57 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
25th Aug 2021, 8:35 AM
Pukhrambam
Pukhrambam - avatar