#13091: admin list_editable with unique_together raises Integrity Error
-------------------------------------+-------------------------------------
     Reporter:  slafs                |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Forms                |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  list_editable        |             Triage Stage:  Accepted
  unique_together IntegrityError     |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  1
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by Fak3):

 Regarding the proposed solution: Why not just add optional kwarg to
 ''is_valid'' method of ''ModelForm''? like this:
 {{{
 #!python
 if form.is_valid(strict_uinique_checks=True):
     obj = form.save()
 }}}
 The "''strict_uinique_checks''" kwarg will force ''ModelForm'' to perform
 uinique_together checks using existing instance values if some.fields are
 omitted in form.

 Another option is to add new Meta option like this:
 {{{
 #!python
 class MyForm(ModelForm):
     class Meta:
         strict_uinique_checks = True
 }}}
 Such form will then always fallback to using existing instance values for
 uinique_together checks when performig validation.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/13091#comment:22>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.aa8eac08633cdb6251d9ab21c16c0a12%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to