Ok, here is some simple code:
class Maker(models.Model):
name = CharField(max_length=20)
class Auto(models.Model):
name = CharField(max_length)
maker = ForeignKey(Maker)
maker = Maker.objects.get(pk=1)
How do I get all the Autos made by this maker
I don't see a maker.autos (railsish)
All I have been able to figure out for this is:
Auto.objects.filter(maker=maker.id) # this works
Auto.objects.filter(maker=maker) # this works too
Is that all there is, or is there some maker.autos abstraction that I
just don't see. The last method 2 methods both work, but it seems
awkward to use them given the fact that I have a Maker, and the
relationship between Maker and Auto is known in the models but via the
Manager interface requires restatement in (maker=maker.id) or
alternately (maker=maker)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---