Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inline-formset-autocomplete.html crashes upon submission #21

Closed
elo80ka opened this issue Feb 27, 2014 · 2 comments
Closed

inline-formset-autocomplete.html crashes upon submission #21

elo80ka opened this issue Feb 27, 2014 · 2 comments

Comments

@elo80ka
Copy link
Owner

elo80ka commented Feb 27, 2014

From bshan...@gmail.com on January 13, 2011 12:06:33

What steps will reproduce the problem? 1. Go to the inline-formset-autocomplete example and hit "submit". it crashes.

What do you see instead?
Environment:

Request Method: POST
Request URL: http://localhost:8000/examples/inline-formset-autocomplete/
Django Version: 1.2.3
Python Version: 2.6.6
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'example']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware')

Traceback:
File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response

  1.                 response = callback(request, _callback_args, *_callback_kwargs)
    
    File "/home/bshanks/prog/pietrust/pie-share/j/demo/example/views.py" in inline_formset
  2.     formset = OrderedItemFormset(request.POST, instance=order)
    
    File "/usr/lib/pymodules/python2.6/django/forms/models.py" in init
  3.                                             queryset=qs)
    
    File "/usr/lib/pymodules/python2.6/django/forms/models.py" in init
  4.     super(BaseModelFormSet, self).**init**(**defaults)
    
    File "/usr/lib/pymodules/python2.6/django/forms/formsets.py" in init
  5.     self._construct_forms()
    
    File "/usr/lib/pymodules/python2.6/django/forms/formsets.py" in _construct_forms
  6.         self.forms.append(self._construct_form(i))
    
    File "/usr/lib/pymodules/python2.6/django/forms/models.py" in _construct_form
  7.     form = super(BaseInlineFormSet, self)._construct_form(i, **kwargs)
    
    File "/usr/lib/pymodules/python2.6/django/forms/models.py" in _construct_form
  8.         pk = self.data[pk_key]
    
    File "/usr/lib/pymodules/python2.6/django/utils/datastructures.py" in getitem
  9.         raise MultiValueDictKeyError("Key %r not found in %r" % (key, self))
    

Exception Type: MultiValueDictKeyError at /examples/inline-formset-autocomplete/
Exception Value: "Key 'ordered_items-0-id' not found in <QueryDict: {u'ordered_items-0-quantity': [u'5'], u'ordered_items-2-quantity': [u'1'], u'ordered_items-3-product': [u'3'], u'ordered_items-5-quantity': [u''], u'ordered_items-3-quantity': [u'3'], u'ordered_items-1-order': [u'1'], u'ordered_items-4-product': [u'3'], u'ordered_items-0-product': [u'1'], u'ordered_items-2-product': [u'7'], u'ordered_items-5-product': [u''], u'ordered_items-1-quantity': [u'1'], u'ordered_items-INITIAL_FORMS': [u'5'], u'ordered_items-2-order': [u'1'], u'ordered_items-0-order': [u'1'], u'ordered_items-4-order': [u'1'], u'ordered_items-TOTAL_FORMS': [u'6'], u'ordered_items-4-quantity': [u'5'], u'customer': [u'Kermit the frog'], u'ordered_items-1-product': [u'3'], u'ordered_items-MAX_NUM_FORMS': [u''], u'ordered_items-5-order': [u'1'], u'ordered_items-3-order': [u'1']}>" What version of the product are you using? On what operating system? 1.2 Firefox GNU/Linux Please provide any additional information below. the template "inline-formset-autocomplete.html" is missing the following two lines which are in inline-formset.html. If you add them it doesn't crash:

                        {&#37; for fld in form.hidden_fields &#37;}{{ fld }}{&#37; endfor &#37;}
                        {&#37; if form.instance.pk &#37;}{{ form.DELETE }}{&#37; endif &#37;}

thanks for all your work on django-dynamic-formset, it's really neat!

Original issue: http://code.google.com/p/django-dynamic-formset/issues/detail?id=21

@elo80ka elo80ka self-assigned this Feb 27, 2014
@elo80ka
Copy link
Owner Author

elo80ka commented Feb 27, 2014

From stan.madueke on January 13, 2011 09:34:10

Thanks. I'll fix the example this weekend.

Status: Accepted
Owner: stan.madueke

@elo80ka
Copy link
Owner Author

elo80ka commented Feb 27, 2014

From stan.madueke on April 23, 2011 10:56:26

Status: Fixed

@elo80ka elo80ka closed this as completed Feb 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant