{% if list|length_is:"1" %}
  Only one!
{% endif %}

http://www.djangoproject.com/documentation/templates/#length-is

  There's also:

{% ifequal list|length "2" %}
  Two here!
{% endifequal %}

http://www.djangoproject.com/documentation/templates/#length

On 4/20/07, drackett <[EMAIL PROTECTED]> wrote:
>
> Is there an easy way in djangos tempaltes to do any sort of counting?
> I want to check if a list of objects only has a single object, and if
> so display something. I could also see this being helpful for any
> number of things using differnt count values. Is this possible?
>
>
> >
>


-- 
Julio Nobrega - http://www.inerciasensorial.com.br

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to