On 4/12/06, Jiri Barton <[EMAIL PROTECTED]> wrote: > > how do I check if a variable is None in a template? > > I want to be able to discern among None, empty list, and non-empty > list; then, I want to tell the user - say nothing, "nothing found", > "found the following:" resp.
This is likely a sign that you're trying to cram too much "programmer" logic into the template. :-) Pass in a search_was_performed variable or whatnot into the template's context: {% if search_was_performed %} {% if search_results %} {% for item in search_results %} ... do stuff ... {% endfor %} {% else %} "No search results were found." {% endif %} {% endif %} --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---