Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Distinguish between None and False/0/[] in a template? [RSS Feed]

#1 Dec. 6, 2010 19:31:21

Christophe P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Distinguish between None and False/0/[] in a template?


Pardon if this is a FAQ, but is there a built-in way of distinguishing between
None and the other typical false values (False/0/) in a template? Something
along the lines of:

{% if var == None %} ... {% endif %}

Thanks!
--
-- Christophe Pettus
x...@thebuild.com

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 6, 2010 20:23:06

Łukasz R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Distinguish between None and False/0/[] in a template?


On 6 December 2010 20:31, Christophe Pettus <x...@thebuild.com> wrote:
> Pardon if this is a FAQ, but is there a built-in way of distinguishing
> between None and the other typical false values (False/0/) in a template?  
> Something along the lines of:
>
>        {% if var == None %} ... {% endif %}
>

It's best to just try before asking if something works :) There is a
filter variant too:http://docs.djangoproject.com/en/dev/ref/templates/builtins/#default-if-none--
Łukasz Rekucki

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Distinguish between None and False/0/[] in a template? [RSS Feed]

Board footer

Moderator control

Enjoy the 12th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support