I'm writing a web application to manage a "game". Here are the models:
class Character(db.Model):
# Bio
name = db.StringProperty()
player = db.StringProperty()
level = db.IntegerProperty()
class Item(db.Model):
name = db.StringProperty()
description = db.StringProperty()
value = db.StringProperty()
class Inventory(db.Model):
character = db.ReferenceProperty(Character,required=True,collection_name="inventory")
item = db.ReferenceProperty(Item,required=True,collection_name="inventory")
quantity = db.IntegerProperty()
equipped = db.BooleanProperty()
I've an Item
database, and when I add a character I want to manage its Inventory
.
I've tried ModelForm
s but they can't handle this sort of things. My idea is to display the complete Item
list, each Item with an associated form quantity,equipped. Something like:
Sword : quantity ___ equipped _ Armor : quantity ___ equipped _
But, how to ship additional informations in forms?
P.S. I'm sorry that the question is dumb and not general, but I couldn't find the keywords to generalize it..