Wednesday, June 30, 2010

Re: ManyToMany container with templating

On Wed, Jun 30, 2010 at 4:15 PM, Rishtastic <rishisingh@gmail.com> wrote:
> Bump?
>
> Sorry guys - need some help with this.
>
> On Jun 29, 5:27 pm, Rishtastic <rishisi...@gmail.com> wrote:
>> Hi all,
>>
>> I'm trying to do
>>
>> foo is a User auth object
>> comments.readers is a ManyToMany field that links back to the User
>>
>> I can iterate just fine by using
>> {% for foo in comments.readers.all %}
>>
>> {% endfor %}
>>
>> But I want to do this:
>>
>> {% if foo in comments.readers.all %}
>> do stuff here
>> {% endif %}
>>
>> is this possible?
>

http://docs.djangoproject.com/en/1.2/ref/templates/builtins/#in-operator

HTH

Tom

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment