#28018: OneToOneField not working with inlineadmin
-------------------------------+--------------------------------------
     Reporter:  alex           |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  new
    Component:  Uncategorized  |                  Version:  1.10
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------

Comment (by kapil garg):

 I think, InlineModelAdmin works for models which have related objects. In
 your example,


 {{{
 # admin.py
 class dInlineAdmin(admin.TabularInline):
     model = d

 @admin.register(b)
 class bSpecializedAdmin(admin.ModelAdmin):
     inlines = [
         dInlineAdmin,
     ]
 }}}

 model "b" is not related to model "d" and thus causing the exception. The
 following code will work

 {{{
 # admin.py
 class aInlineAdmin(admin.TabularInline):
     model = a

 @admin.register(d)
 class bSpecializedAdmin(admin.ModelAdmin):
     inlines = [
         aInlineAdmin,
     ]
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28018#comment:1>
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/065.fb90c3348c809b24f8942601a127cceb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to