Getting All Objects Referenced In A Foreign Key Field
I have models similar to class Person(Model): name = CharField(max_length=100) class Movie(Model): ... director = ForeignKey(Person) How would I get the set of all Pe
Solution 1:
I figured it out,
Person.objects.exclude(director__set=None)
Post a Comment for "Getting All Objects Referenced In A Foreign Key Field"