#34979: inlineformset_factory sets max_num forms to one even though there is a
unique_together constraint
-----------------------------------------+------------------------------
               Reporter:  ehallein       |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  contrib.admin  |        Version:  3.2
               Severity:  Normal         |       Keywords:  inline admin
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  1              |
-----------------------------------------+------------------------------
 I have a unique_together primary key in one of my models.  When adding an
 inline admin for that model, the interface only allows adding one new
 object.  I have tracked it down to code in django/django/forms/models.py:
 {{{
 fk = _get_foreign_key(parent_model, model, fk_name=fk_name)
     # enforce a max_num=1 when the foreign key to the parent model is
 unique.
     if fk.unique:
         max_num = 1
 }}}

 While this makes sense for a single unique primary key, it is the wrong
 behavior for a composite primary key.

 Is a fix needed in Django so multiple objects with unique_together primary
 keys can be added as inlines, or should this be done using custom code?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34979>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018beaa6f107-66adf339-ea8a-412b-877c-af6cefe6788c-000000%40eu-central-1.amazonses.com.

Reply via email to