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

 You can reproduce the bug using django_extensions UUIDField()
 implementation using this setup :

 using : django 1.2.3 , django-extensions 0.5, PGSQL db with psycopg2

 in settings.py
 {{{
 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
     'django.contrib.sites',
     'django.contrib.messages',
     'django.contrib.admin',
     'django_extensions',
     'myapp',
 )
 }}}

  in myapp/models.py

 {{{
 from django.db import models
 from django_extensions.db import fields as exfields

 class Worker(models.Model):
     id = exfields.UUIDField(primary_key=True)
     name = models.CharField(blank=True, max_length=100)
     def __unicode__(self):
         return(self.name)

 class Task(models.Model):
     id = exfields.UUIDField(primary_key=True)
     description = models.CharField(blank=True, max_length=100)
     workers = models.ManyToManyField(Worker, through="Todo")
     def __unicode__(self):
         return(self.description)

 class Todo(models.Model):
     id = exfields.UUIDField(primary_key=True)
     worker = models.ForeignKey(Worker)
     task = models.ForeignKey(Task)
 }}}

 in myapp/admin.py

 {{{
 from django.contrib import admin
 from myapp.models import *

 class WorkerAdmin(admin.ModelAdmin):
     pass

 class TodoInline(admin.TabularInline):
     model = Todo
     fk_name = 'task'
     raw_id_fields = ('worker',)
     extra = 1

 class TaskAdmin(admin.ModelAdmin):
     inlines = (TodoInline,)

 admin.site.register(Worker,WorkerAdmin)
 admin.site.register(Task,TaskAdmin)
 }}}

 Once db synced and admin urls setup, foillow these steps to reproduce the
 bug :[[BR]]
 1. Log into admin, add some workers[[BR]]
 2. Go to Task admin, add a task, add a related worker to it, save[[BR]]
 3. Go back to this same task admin page, and just try to save again, or
 add a worker and save, you got :[[BR]]

 MultiValueDictKeyError at /admin/myapp/task/c64af3b5-f6e4-11df-869c-
 001cb3bc281a/[[BR]]

 "Key 'todo_set-0-id' not found in <QueryDict: .....>"


 https://gist.github.com/711535

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12235#comment:18>
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