I'm using the app-engine-patch to have a better integration with
Django.
I'm trying to input a character/inventory relation but something is
going wrong and I'm getting stuck. Each time I 'submit' the form I get
a `ValidationError` when processing the view, the exact point is when
instantiating the inline formset,
invform = bforms.InventoryInlineFormSet(request.POST,
instance=ch)
Reading the traceback it seems that he can't find some required
parameters...
Here's the POST:
inventory-0-character
u''
inventory-0-quantity
u'1'
inventory-0-item
u'ag5kMjBtYXN0ZXJ0b29sc3IRCxILY29tYmF0X2l0ZW0YEQw'
inventory-0-key
u''
The models are that:
from google.appengine.ext import db
# Create your models here.
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()
And the formset is that:
InventoryInlineFormSet = inlineformset_factory(models.Character,
models.Inventory)
Now the view:
def create(request):
if request.method == 'GET':
invform = bforms.InventoryInlineFormSet()
chform = bforms.CharacterForm()
if request.method == 'POST':
chform = bforms.CharacterForm(request.POST)
if chform.is_valid():
ch = chform.save()
invform = bforms.InventoryInlineFormSet(request.POST,
instance=ch)
payload = dict(chform=chform,invform=invform)
return render('create.html', request,payload)
--
You received this message because you are subscribed to the Google Groups
"app-engine-patch" 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/app-engine-patch?hl=en.