I may be wrong but I believe that the you cannot use the If statement inside a template to evaluate a specific value. You use it to determine whether the object or value exists ( has been returned by the view).
I think that this is because the developers wanted to maintain a distinction between the presentation and the logic. I seem to remember that someone has written some code, as a patch, to allow the IF statement to evaluate specific values, but cannot remember where the code is. MerMer > > <h2>Registered Players</h2> > <ul> > {% for player in object.player_set.all %} > <li>{{ player.forename }} {{ player.surname }} > ({{ player.age }})</li> > {% endfor %} > {% if object.player_set.all == "" %} > No players currently registered > {% endif %} > </ul> > > > Request Method: GET > Request URL: http://duncanm.webfactional.com/teams/1/ > Exception Type: TemplateSyntaxError > Exception Value: 'if' statement improperly formatted > Exception Location: /home2/duncanm/lib/python2.4/django/template/ > defaulttags.py in do_if, line 608 > > I know this is a very stupid question but from my code above I get > that error (also above). What is the correct way of using an if > statement to display some text if object.player_set.all is empty?? > > Thanks > > > > > > > ------------------------------------------------------------------------ > > Internal Virus Database is out-of-date. > Checked by AVG Free Edition. > Version: 7.1.410 / Virus Database: 268.16.11/627 - Release Date: > 15/01/2007 > > > --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---