class Pathology(models.Model): pathology = models.CharField(max_length=100, null=True, blank=True)
class Pathpubcombo(models.Model): pathology = models.ForeignKey(Pathology) publication = models.ForeignKey(Publication) Currently, I select all the pathologies from the model Pathology and send to a drop down list on the template: def publications(request): pathology_list = Pathology.objects.all().order_by('pathology') return render_to_response("search/search.html", "pathology_list": pathology_list, }) I would like to filter the pathology list, so that it only selects the unduplicated pathology ids from the model Pathpubcombo. I've tried several variations of the following statement, but always get an error: This is the working statement, but doesn't subset pathology_id from Pathpubcombo pathology_list = Pathology.objects.all().order_by('pathology') and this one doesn't work: pathology_list = Pathology.objects.select_related().get (pathpubcombo__pathology__id) Thanks for any help. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---