I have a query I am trying to perform in the ORM and I'm not sure how to do it.
I have two models: Target and Property with a one-to-many relationship. One Target can have many Properties.
I want to list all targets along with their latest properties (as stored under Property.export_date) sorted by fields on Property.
So if I have this simplified model:
Target
- name
- t1
- t2
Property
- fk_to_target
- export_date
- p1
- p2
I want to have a list of record each having [name, t1, t2, export_date, p1, p2] with every target only being once in the list with its latest property.
How do I make this happen in the ORM?
-- 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment