Hi Malcolm, Thanks for your response, but I'm not quite sure how to iterate using obj.query.all to get all the instances I'm after.
Could you please provide a code snippet or direct me to a relevant page? Thanks again, Alex On Feb 3, 4:04 pm, Malcolm Tredinnick <[email protected]> wrote: > On Mon, 2009-02-02 at 20:52 -0800, Alexiski wrote: > > Hi all, > > This is a difficulty related to me being new to Django/Python I > > assume, so I hope you can forgive my ignorance and help me out :) > > > I have 4 tables - User(overriding the user object), Copy, Query, > > QueryClassification. The main tables are Copy and Query. There can be > > many Queries for each Copy, so... > > > Query has: > > copy = models.ForeignKey(Copy) > > classification = models.ManyToManyField(QueryClassification) > > Copy has: > > user = models.ForeignKey(User) > > > Basically it isn't displaying any of the fields from Query or > > QueryClassification and I'm not quite sure how to reference the other > > foreign tables in reference to a one-to-many field. Clearly I can > > iterate through the Copy items, but I can't get it to print the > > multiple Query items next to the appropriate Copy items. > > Given a Copy instance, obj, you can access the related Query instances > (in a template) as obj.query.all. So iterate over that to get all the > instances you're after. > > Regards, > Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

