Opened 15 years ago

Last modified 12 years ago

#12235 closed

MultiValueDictKeyError when editing Inline objects — at Initial Version

Reported by: bruce@… Owned by: nobody
Component: contrib.admin Version: 1.2
Severity: Normal Keywords:
Cc: wgordonw1@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

the attached simple model (Book and Author), using a custom UUID type as described here: http://www.gordontillman.info/computers/41-django/94-django-uuidfield-problem

If you add a book with an author, and then try to edit the authors (add a second one, edit the name, etc), you will generate this error:

MultiValueDictKeyError at /admin/gamedata/book/7432e312-d39b-11de-913b-00188b8e3ea8/

Key 'author_set-0-id' not found in <QueryDict: {u'_save': [u'Save'], u'author_set-TOTAL_FORMS': [u'5'], u'author_set-0-book': [u'7432e312-d39b-11de-913b-00188b8e3ea8'], u'title': [u'book1'], u'author_set-0-name': [u'author1'], u'author_set-3-name': [u''], u'author_set-2-book': [u'7432e312-d39b-11de-913b-00188b8e3ea8'], u'author_set-INITIAL_FORMS': [u'2'], u'author_set-4-name': [u''], u'author_set-2-name': [u'asdasdasd'], u'author_set-3-book': [u'7432e312-d39b-11de-913b-00188b8e3ea8'], u'author_set-1-book': [u'7432e312-d39b-11de-913b-00188b8e3ea8'], u'author_set-4-book': [u'7432e312-d39b-11de-913b-00188b8e3ea8'], u'author_set-1-name': [u'authro2']}>

Traceback:
File "/usr/lib64/python2.6/site-packages/django/core/handlers/base.py" in get_response

  1. response = callback(request, *callback_args, callback_kwargs)

File "/usr/lib64/python2.6/site-packages/django/contrib/admin/options.py" in wrapper

  1. return self.admin_site.admin_view(view)(*args, kwargs)

File "/usr/lib64/python2.6/site-packages/django/utils/decorators.py" in call

  1. return self.decorator(self.func)(*args, kwargs)

File "/usr/lib64/python2.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func

  1. response = view_func(request, *args, kwargs)

File "/usr/lib64/python2.6/site-packages/django/contrib/admin/sites.py" in inner

  1. return view(request, *args, kwargs)

File "/usr/lib64/python2.6/site-packages/django/db/transaction.py" in _commit_on_success

  1. res = func(*args, kw)

File "/usr/lib64/python2.6/site-packages/django/contrib/admin/options.py" in change_view

  1. instance=new_object, prefix=prefix)

File "/usr/lib64/python2.6/site-packages/django/forms/models.py" in init

  1. queryset=qs)

File "/usr/lib64/python2.6/site-packages/django/forms/models.py" in init

  1. super(BaseModelFormSet, self).init(defaults)

File "/usr/lib64/python2.6/site-packages/django/forms/formsets.py" in init

  1. self._construct_forms()

File "/usr/lib64/python2.6/site-packages/django/forms/formsets.py" in _construct_forms

  1. self.forms.append(self._construct_form(i))

File "/usr/lib64/python2.6/site-packages/django/forms/models.py" in _construct_form

  1. form = super(BaseInlineFormSet, self)._construct_form(i, kwargs)

File "/usr/lib64/python2.6/site-packages/django/forms/models.py" in _construct_form

  1. pk = self.data[pk_key]

File "/usr/lib64/python2.6/site-packages/django/utils/datastructures.py" in getitem

  1. raise MultiValueDictKeyError, "Key %r not found in %r" % (key, self)

Change History (1)

by bruce@…, 15 years ago

Attachment: models.py added
Note: See TracTickets for help on using tickets.
Back to Top