On 12 Lis, 16:12, Chris <chrisbrett...@googlemail.com> wrote:
> Is there a way of getting a model function to access user details so
> that I can do a simple "if track.owned" in the template? Is there a
> better solution to doing it in the view? Is there something I have not
> thought of? What would be the "best practice" solution to this?
>

Just some quick ideas (after 10h of work, so watch out ;)):

1. You can write custom tag {%ifowned track request.user%}

2. You can try something less elegant:

{%for user in track.m2m_users.all%}
{%ifequal user request.user%}
<do what you want here>
{%endifequal%}
{%endfor%}

- but it's only good for small apps, as a temp solution.

--
Tomasz Zieliński
http://pyconsultant.eu

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.


Reply via email to