Opened 8 years ago

Closed 5 years ago

#7865 closed New feature (wontfix)

Inline Edits across Apps

Reported by: magneto Owned by: nobody
Component: Forms Version: master
Severity: Normal Keywords: newforms-admin edit_inline
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


One little feature that is either a) missing or b) not documented that existed in the 'old forms admin' was the ability to 'edit_inline' across Apps

## the 'old way'
# myapp1/
class M1(models.Model):
   col1 = ...

from mapp1.models. import M1
class M2(models.Model):
   m1 = models.ForeignKey(M1, edit_inline = models.STACKED)
   col1 = ...

The above would make the 'M2' editable inline inside the admin form for M1
This obviously would depend on the Order of the Apps loading in settings (i.e. M1 before M2)

But this is nice little feature and can be replicated with a 'hack' to the new-forms admin of sorts

# in myapp2/
from myapp1.models import M1
from myapp2.models import M2
from django.contrib import admin

class M2_Inline(admin.StackedInline):
	model = M2

## here it the hack
## get the User instance from the current admin set up and add these inlines
if M1 in
	## add to inlines of the base User
	inline_instance = M2_Inline([M1].model,[M1].admin_site)[M1].inline_instances.append(inline_instance)


It would be _nice_ to simply have some methods to the _registry of the AdminSite object, and even, perhaps an "AdminSite .add_to_inlines("TargetModel", [List of Other Inlines])

I Imagine this requires some design designs as to weather or to to allow access to the AdminSite overloard object

Attachments (1)

admin_site_add_to_inlines.diff (1.1 KB) - added by magneto 8 years ago.
A 'add_to_inlines' funciton for AdminSite

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by magneto

A 'add_to_inlines' funciton for AdminSite

comment:1 Changed 8 years ago by Eric Holscher

milestone: post-1.0
Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:3 Changed 6 years ago by Luke Plant

Severity: Normal
Type: New feature

comment:4 Changed 5 years ago by Alex Gaynor

Easy pickings: unset
Resolution: wontfix
Status: newclosed
UI/UX: unset

wontfixing: the correct solution to wanting to alter something's model admin from a differnt app is to unregister the current model admin, subclass it, and register your own.

Note: See TracTickets for help on using tickets.
Back to Top