On Sun, Feb 22, 2009 at 10:13 PM, Chris <chriss...@gmail.com> wrote:

>
> I'm displaying a list of records in a template. I want to
> conditionally display controls for each record if the current user is
> admin, or the user owns the given record (indicated by record.user ==
> request.user).
>
> What's the best way to do this? Logically, all I want to do is {% if
> request.user.is_superuser or request.user == record.user %} display
> controls {% endif %} inside the loop. However, Django's default
> template language doesn't seem to support this basic syntax. Is there
> a non-hackish way to accomplish this with the default language?
>
> Regards,
> Chris
> >
>
Easies way would just be to have 2 seperate if statements(using {% ifequal
%} for the second one) and either and and {% include %} so you don't
duplicate all the HTML.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

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

Reply via email to