#27967: The autogenerated OneToOneField on multi table inheritance breaks the
InlineAdminForm given UUID pk
-------------------------------+------------------------------------
     Reporter:  Robin Anupol   |                    Owner:  (none)
         Type:  Bug            |                   Status:  new
    Component:  contrib.admin  |                  Version:  1.10
     Severity:  Normal         |               Resolution:
     Keywords:  admin          |             Triage Stage:  Accepted
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+------------------------------------

Comment (by Robin Anupol):

 As a workaround, on the app's admin.py, I have this prepended:
 {{{
 # admin.py
 from django.contrib.admin.helpers import InlineAdminForm

  def needs_explicit_pk_field(self):
     # original definition goes here
     # place this conditional right before the end of the function
     if self.form._meta.model._meta.pk.auto_created:
         return True
     return False

 InlineAdminForm.needs_explicit_pk_field = needs_explicit_pk_field

 from django.contrib import admin
 # the rest of admin.py goes here.
 }}}

 This works for me but I'm not sure of any edge cases associated with the
 auto_created attribute.

--
Ticket URL: <https://code.djangoproject.com/ticket/27967#comment:5>
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.6a54b5db84486cb8ca4138a5a752a259%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to