Sunday, January 10, 2010

Re: Django Groups In Templates

user.groups.all returns not one but (possibly) many objects. Thus you
will have to do something like

{% for group in user.groups.all %}
{% if group.name == 'subscribed' %}
Hello
{% endif %}
{% endfor %}

Regards,
GBS


On Jan 10, 1:12 pm, Dave Merwin <dave.mer...@gmail.com> wrote:
> I'm trying to do something I thought was simple.
>
> {% ifequal user.groups "subscribed"  %}
>     Hello
> {% endifequal %}
>
> But it's not working...
>
> Any tips?

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate