>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
--
Joel Goldstick
Hi, thanks for the reply.
'==' tests equality
'=' assigns a rvalue
Cheers
Tom
Sorry the '==' was a typo, its actually:
EnableLogUpload = "Enabled"
on top you check if EnableLogUpload = '1' Later on you check if it = 'Enabled'
--
Joel Goldstick
Also, if you are expecting the string "Enabled" or "Disabled" to be
passed in to the template, you are overcomplicating things by saying
{% if EnableLogUpload == "Enabled" %}Enabled{% else %}Disabled{% endif
%}
You could just say
{{ EnableLogUpload }}
But none of that will solve your problem, because EnableLogUpload is
clearly not set to the string "Enabled". I can say for sure that you're
passing it in wrong from the view, but I can't say how without seeing
your view code. Please share that as well.
If I were doing it from scratch, I would just make a the EnableLogUpload
variable a boolean, and worry about how I want to render it in the
template. I would also use standard python naming conventions (because
the most important task of code is to communicate with other
programmers, and only secondarily to make a computer do things). The
simplified version would look like this:
=== views.py ===
def view(request):
context = {'enable_log_upload': True}
return render('template.html', context)
=== end views.py ===
=== template.html ===
{% if enable_log_upload %}enabled{% else %}disabled{% endif %}
=== end template.html ===
Note that I'm not trying to test if enable_log_upload is equal to
anything in particular. I just want to know if it's a true value or
not.
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/x6xX1B-NbYcJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users