I apologize if this is an old question, I did search SO/google for a good few hours.
-- I have the following models.
Publisher() name = CharField()
Medium() name = CharField()
Article() publisher = ForeignKey(Publisher, related_name="articles") medium = ForeignKey(Medium, related_name="articles") text = TextField()
PublisherMediumBilling() publisher = ForeignKey(Publisher() medium = ForeignKey(Article)
lots_of_other_columns ...
class Meta:
unique_together = ['publisher', 'medium']
I am looking to query all Article from a given publisher, and also fetch the related PublisherMediumBilling joining on the columns Publisher and Medium, Prefetch() object doesn't seem to quite work for this case.
I can of course filter-query for all PublisherMediumBilling and cache it and do a in-memory Python JOIN. Is there a way to do through one of the ORM Apis ?
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5bf63dc4-18fc-4fa4-85ad-6467e16043fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment