Sunday, January 10, 2010

Re: Django Groups In Templates

Brilliant!! That worked. Thanks.

On Jan 10, 12:19 am, G B Smith <greenblanket.sm...@gmail.com> wrote:
> 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