#12235: MultiValueDictKeyError when editing Inline objects
-------------------------------------------+--------------------------------
          Reporter:  br...@playfirst.com   |         Owner:  nobody
            Status:  new                   |     Milestone:  1.2   
         Component:  django.contrib.admin  |       Version:  1.1   
        Resolution:                        |      Keywords:        
             Stage:  Accepted              |     Has_patch:  0     
        Needs_docs:  0                     |   Needs_tests:  0     
Needs_better_patch:  0                     |  
-------------------------------------------+--------------------------------
Comment (by matiasb):

 I think the problem could be in the definition of the UUIDField in the
 attached file. There, the id (an AutoField) is being replaced with an
 UUIDField, thus this field should work as an auto field. Then, adding the
 following to the UUIDField class definition solves the issue:

 {{{
     def contribute_to_class(self, cls, name):
         assert not cls._meta.has_auto_field, "A model can't have more than
 one AutoField."
         super(UUIDField, self).contribute_to_class(cls, name)
         cls._meta.has_auto_field = True
         cls._meta.auto_field = self
 }}}

 What was the problem? When generating the template for inline forms, as
 the Author instances didn't have an auto_field, there wasn't any hidden
 field to relate the shown Author instance with the previously saved Author
 when editing a Book (in stacked.html and tabular.html templates):
 {{{
 {% if inline_admin_form.has_auto_field %}{{
 inline_admin_form.pk_field.field }}{% endif %}
 }}}

 However, the saving view expects the 'author_set-0-id' field with the uuid
 (primary key) of the author to be updated. I'm assuming the if tag in the
 template is needed to be there, as defined.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12235#comment:10>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to