Opened 15 years ago
Last modified 12 years ago
#12235 closed
MultiValueDictKeyError when editing Inline objects — at Initial Version
Reported by: | 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
- response = callback(request, *callback_args, callback_kwargs)
File "/usr/lib64/python2.6/site-packages/django/contrib/admin/options.py" in wrapper
- return self.admin_site.admin_view(view)(*args, kwargs)
File "/usr/lib64/python2.6/site-packages/django/utils/decorators.py" in call
- return self.decorator(self.func)(*args, kwargs)
File "/usr/lib64/python2.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
- response = view_func(request, *args, kwargs)
File "/usr/lib64/python2.6/site-packages/django/contrib/admin/sites.py" in inner
- return view(request, *args, kwargs)
File "/usr/lib64/python2.6/site-packages/django/db/transaction.py" in _commit_on_success
- res = func(*args, kw)
File "/usr/lib64/python2.6/site-packages/django/contrib/admin/options.py" in change_view
- instance=new_object, prefix=prefix)
File "/usr/lib64/python2.6/site-packages/django/forms/models.py" in init
- queryset=qs)
File "/usr/lib64/python2.6/site-packages/django/forms/models.py" in init
- super(BaseModelFormSet, self).init(defaults)
File "/usr/lib64/python2.6/site-packages/django/forms/formsets.py" in init
- self._construct_forms()
File "/usr/lib64/python2.6/site-packages/django/forms/formsets.py" in _construct_forms
- self.forms.append(self._construct_form(i))
File "/usr/lib64/python2.6/site-packages/django/forms/models.py" in _construct_form
- form = super(BaseInlineFormSet, self)._construct_form(i, kwargs)
File "/usr/lib64/python2.6/site-packages/django/forms/models.py" in _construct_form
- pk = self.data[pk_key]
File "/usr/lib64/python2.6/site-packages/django/utils/datastructures.py" in getitem
- raise MultiValueDictKeyError, "Key %r not found in %r" % (key, self)