On Jun 24, 3:35 pm, nobody <[EMAIL PROTECTED]> wrote:
> I'm sure this is very common knowledge but for the life of me I can't
> find it in the documentation or the djangobook.
>
> I have a ManyToManyField in my model. Categories to Articles.
>
> In my template I try to pull it out like so:
> <h2 class="most_recent">{{article.categories }}: {{ article.title }}</
> h2>
Since you can have many categories, you have to iterate over them.
Something like this should work:
<h2 class="most_recent">{% for cat in article.categories.all %}
{{cat.title }} {% endfor %}: {{ article.title }}</h2>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---