I'm fairly new to Django/Python so please bear with me.
I want to create some methods in my models that return boolean values
(has_employees, etc) but I cannot seem to access the return value in the
template.
Here's a cut-down example:
Model:
def fcnTrue():
return True
View:
return render_to_response('myapp/test.html',
{ 'varTrue' : True})
Template:
{% if varTrue %} varTrue = true {% endif %}<br />
{% if fcnTrue %} fcnTrue = true {% endif %}<br />
Expected output:
varTrue = true
fcnTrue = true
Actual output:
varTrue = true
What am I doing wrong?
--
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/-/-PrrNhcSJnkJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.