#13091: admin list_editable with unique_together raises Integrity Error
-------------------------------------+-------------------------------------
Reporter: slafs | Owner: nobody
Type: Bug | Status: new
Milestone: 1.3 | Component: contrib.admin
Version: SVN | Severity: Normal
Resolution: | Keywords: list_editable
Triage Stage: Design | unique_together IntegrityError
decision needed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 1 | Easy pickings: 0
-------------------------------------+-------------------------------------
Comment (by legutierr):
The patch I just attached should address all of your issues, Carl, except
that I don't quite understand what you are referring to in your last
bullet, regarding setting form.instance prior to validation. I do not see
anything comparable in #15326. Did you mean #13249?
I realize that setting values on form.instance prior to calling
form.is_valid() is not the normal approach, but I am not sure if there is
any other approach that makes as much sense. The validate_unique() call
needs to be made only after the final values are set on the ORM instance,
otherwise the check will not catch the kinds of errors that we are trying
to catch prior to the database being hit. Because is_valid only
calculates its the form errors once (after which they are cached), all of
this has to be done before is_valid is called, and updating form.instance
seems to be the easiest way.
That being said, I did change things so that they would look a little bit
more like Russel's example in #13249. Is that all you were thinking?
--
Ticket URL: <http://code.djangoproject.com/ticket/13091#comment:15>
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.