My experience is that using the the various conditional templatetags is painful. I can never seem to do what I want, either because I'm too much of a newbie or there is some gotcha such as "filters don't work inside if" (I seem to remember something like that, but again, it might just be my own problem)
I've come to the conclusion that it is easier to use a template tag. That way I can just do my thing with a little bit of python that I completely understand, and I don't have to constantly be looking up what I can do with the template language. I find the template tags where you define the tag and the renderer to also be very useful, as these give you access to the context. Margie On Feb 22, 7:13 pm, Chris <[email protected]> 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 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

