Opened 16 years ago

Closed 13 years ago

#7865 closed New feature (wontfix)

Inline Edits across Apps

Reported by: magneto Owned by: nobody
Component: Forms Version: dev
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

Description

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/models.py
class M1(models.Model):
   col1 = ...

#myapp2/models.py
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/admin.py
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 admin.site._registry:
	## add to inlines of the base User
	inline_instance = M2_Inline(admin.site._registry[M1].model, admin.site._registry[M1].admin_site)
	admin.site._registry[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 16 years ago.
A 'add_to_inlines' funciton for AdminSite

Download all attachments as: .zip

Change History (5)

by magneto, 16 years ago

A 'add_to_inlines' funciton for AdminSite

comment:1 by Eric Holscher, 16 years ago

milestone: post-1.0
Triage Stage: UnreviewedDesign decision needed

comment:2 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:3 by Luke Plant, 14 years ago

Severity: Normal
Type: New feature

comment:4 by Alex Gaynor, 13 years ago

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