Got this model
class AdviceLevel(models.Model):
    advice = models.ForeignKey(Advice)
    organisation = models.ForeignKey(Organisation)
    specialism = models.ManyToManyField(Specialism, null=True, blank=True)
    service_restriction = models.TextField(null=True, blank=True)

in the view
    dir_list = AdviceLevel.objects.all().filter(advice=advice)

so I get a list

in the template
    {% for d in dir_list %}
        {{ d.organisation.title }}
        {{ d.servicerestriction }}    //etc
  
// but when it comes to the many to many how do I access each
// d.specialsm gets however many selected 
<django.db.models.fields.related.ManyRelatedManager object at 0x973bb6c>
// tried d.specialism_set.all but I get AttributeError: 
'ManyRelatedManager' object has no attribute 'set' also
// tried for x in d.specialism but get  'AdviceLevel' object has no 
attribute 'specialsm'

So how do I access the individual fields of the manytomany results of 
specialism in the template please?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dd19110f-d425-44cb-b4f3-ad2b1596b3ad%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to