I am trying to use the generic view, object_detail on a m2m relationship. I have multiple businesses that offer multiple services. I would like to show the services offered by each business. At the moment, I see all the services - not just the services that a particular business is offering.
In models.py: class Business(models.Model): business = models.CharField(max_length=100) class Service(models.Model): service = models.CharField(max_length=100) providers = models.ManyToManyField(Business, through = "BusinessService") class BusinessService(models.Model): business = models.ForeignKey(Business) service = models.ForeignKey(Service) In urls.py: def get_service(): return Service.objects.all() businessservice_list = { #'queryset' : BusinessService.objects.all(), 'queryset' : Business.objects.all(), 'extra_context': {'service_list': get_service} ...skip some detail... (r'^showservice/(?P<object_id>\d+)/$', list_detail.object_detail, businessservice_list), In business_detail.html: {% block content %} <h2>Business Services</h2> {% if object %} <h3>{{ object.business }}</h3> {{ service_list }} {% endif %} {% endblock content%} -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.