#24958: Inline admins broken with UUID parent key and AutoField child key -------------------------------+-------------------- Reporter: jhoos | Owner: nobody Type: Uncategorized | Status: new Component: Forms | Version: 1.8 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 1 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------- If you have a parent model that has a UUIDField as a primary key, and a child model that uses the default AutoField as its primary key, then an admin form that uses an inline form containing that child model will fail with a `Please correct the errors below.` message with no other errors on the form.
The underlying cause turned out to be related to issue #24377. The fix for that issue accounted for both parent and child being UUID-based, but not for the mixed case. Specifically, in the `add_fields` method of `BaseInlineFormSet`, #24377 checks to see if the parent object is being added, and then checks to see whether the primary key field on the child object is using a generated default value. It should instead be checking whether the related key field on the //parent// object is using a generated value. I have a pull request with a potential fix for this issue. It also fixes the similar case where the AutoField child model is related to a UUIDField alternate key in the parent model. -- Ticket URL: <https://code.djangoproject.com/ticket/24958> 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 post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/048.817d29ac36f8b8ca5b7e2d9907de9846%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.