Foriegn Key Use case
Class Item():
desc = models.StringFrield()
Class Menu():
type = models.StringField(default = "Italian") ///cuisine type
item_list = models.ForiegnKey(Item)
So for each cuisine I have some list of items
for ex:
menu type 1 for ex have 5 items (item 1, item2, item 3, item4, item5)
Creating items is easy
item = Item()
item.desc = "item1"
item.save()
item = Item()
item.desc = "item 2"
item.save()
so on......
Now I have to create just a single menu item
menu = Menu()
menu.type ="Italian"
menu.item_list = ??? ///i am not sure what should be this , should
it be assigned to any one of them
Then how to retreieve the list of items for a menu ex: here Italian
Thanks.
--RJ
--
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.