#21135: Admin: Support for editing OneToOne related models in RELATED model
-------------------------------+--------------------
     Reporter:  jonash         |      Owner:  nobody
         Type:  New feature    |     Status:  new
    Component:  contrib.admin  |    Version:  1.5
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 Consider these models:

 {{{
 class Person(models.Model):
   address = models.OneToOneField("Address")

 class Organization(models.Model):
   address = models.OneToOneField("Address")

 class Building(models.Model):
   address = models.OneToOneField("Address")
 }}}

 Currently it's not possible to have a different `ModelAdmin` for each of
 the above models because the `ModelAdmin.inlines` property works a
 *reversed* manner.

 Using the new feature would look like this (same `AddressAdmin` for every
 model)

 {{{
 class AddressAdmin(admin.TabularInline):
   model = Address

 class PersonAdmin(admin.ModelAdmin):
   inlines = [AddressAdmin]

 class OrganizationAdmin(admin.ModelAdmin):
   inlines = [AddressAdmin]

 class BuildingAdmin(admin.ModelAdmin):
   inlines = [AddressAdmin]
 }}}

 or even like this (different `AddressAdmin`)

 {{{
 class PersonAddressAdmin(admin.TabularInline):
   model = Address

 class OrganizationAddressAdmin(admin.TabularInline):
   model = Address

 class BuildingAddressAdmin(admin.TabularInline):
   model = Address

 class PersonAdmin(admin.ModelAdmin):
   inlines = [PersonAddressAdmin]

 class OrganizationAdmin(admin.ModelAdmin):
   inlines = [OrganizationAddressAdmin]

 class BuildingAdmin(admin.ModelAdmin):
   inlines = [BuildingAddressAdmin]
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21135>
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/049.9ca1513bf83021d606e369a74b4f4e3f%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to