#14832: Impossible to create inline objects if form validates but is unchanged -------------------------------+------------------------------------ Reporter: Julien Phalip | Owner: nobody Type: Bug | Status: new Component: contrib.admin | Version: 1.4 Severity: Normal | Resolution: Keywords: sprintdec2010 | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 1 -------------------------------+------------------------------------
Comment (by David): After about 14 years after the first report (#11807) this issue is still present. I belive that this may be addressed with a change in the APIs in inline admins and model-formset. But first it must be defined a logic to handle this operation: * **one-to-one** inline is easy, it should be created * **many-to-one** inline is not so easy, since it depends on the application context * **many-to-many** inline should follow the same criteria as many-to-one For these reasons I propose the following mechanism: * add a new method to `InlineModelAdmin` which controls over the "create- if-empty" mechanism, which should receive as params the main object and count of already handled "empty" forms and which should return a boolean (indicating if the empty form shall be created or not) * add a new optional attribute to `BaseInlineFormSet` which is going to hold a method like that described above * override the `save_new_objects` in `BaseInlineFormSet` to handle the abovementioned attribute and thus proceeding with the creation of "empty" forms when confirmed. -- Ticket URL: <https://code.djangoproject.com/ticket/14832#comment:8> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/01070186a1e3e7c5-1eb3ac08-2a1d-43fc-a0c2-e5fdc016f7e8-000000%40eu-central-1.amazonses.com.