Kai Kuehne wrote:
> If you only want to list the tags related to the current blog entry (e.g., on
> a object_detail generic view site) I would wrap the generic view instead
> of filling the urls.py file with logic. Imho, there should be no logic
> in urls.py
>
> And that is what I'm trying to understand... why do I *have to* wrap a
> generic view and return the object_detail. When using manage.py shell,
> I don't have to. If I access Post.tags, they are there. Why not in the
> application?
> (I used a ManyToMany-Field to link between Post & Tag.)
Wait, can't you just use post.tags.all in your object_detail template
without any wrappers (for all tags related to a post)? Django will
auto-populate such a related list in a generic view:
{% if post.tags.all %}
tags: {% for tag in post.tags.all %}
<a href="/tag/{{ tag.norm_value }}">{{ tag.value }}</a>
{% endfor %}
{% endif %}
Nate.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---