{% for cat in client.categories.all %}
   {{cat.name}}
{% endfor %}

On 14 янв, 16:41, shocks <[EMAIL PROTECTED]> wrote:
> Hi
>
> I'm trying to get a ManyToManyField working in my model.  It all works
> fine apart from the functionality in my view template.  I'm using it
> to export some XML and have an 'ifeqaul' condition to test which
> category(ies) a client is associated with.
>
> A ForeignKey setup works fine for my template.
> Model: category = models.ForeignKey(Category)
> Condition in View template: {% ifequal client.category.name
> category.name %}
>
> I can successfully find the category name for a client with this
> setup.
>
> I'd like to be able to use a ManToManyField in my model instead like
> this (some clients are associated with multiple cateogories):
> categories = models.ManyToManyField(Category, related_name='entries',
> filter_interface=models.HORIZONTAL)
>
> I'm unable, however to get the category names for a given client.
>
> I've been looking at this code for ages and can't see where I'm going
> wrong.
>
> Thanks
> Ben
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to