Re: Question on passing user to model objects
Hi Daniel,
> However, calling foo.bar_set multiple times does *not* get the same
> queryset each time.
Okay, that was new to me :-)... Do you know what the reason for that
is?
> I discuss this a little in a blog
> entry here:http://blog.roseman.org.uk/2010/01/11/django-patterns-part-2-efficien...
Thanks! I thank that is exactly what I want to achieve. I changed
_related_items to related_items (else Django would give me an error).
The data should now be correct.
I have a little problem passing the dict to the template though. When
I did so, the template would have the keys - not the actual values.
I also added:
obj_arr=[]
for key, obj in obj_dict.items():
obj_arr.append(obj)
It's not very beautiful, but keeps the designer from using {% for
key,value in dictionary.items %}{{ value }}{% endfor %}
> Does this necessarily need to be a model method? Why not a custom
> template tag or filter, that you can pass the request.user object to?
Then the filter would have to be inserted everywhere where any of the
object's attributes should be shown (the edit button is shown for each
visible attribute).
Thanks a lot!
Stephan
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home