#7865: Inline Edits across Apps
----------------------------------------+-----------------------------------
Reporter: magneto | Owner: nobody
Status: new | Milestone:
Component: django.newforms | Version: SVN
Keywords: newforms-admin edit_inline | Stage: Unreviewed
Has_patch: 0 |
----------------------------------------+-----------------------------------
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
--
Ticket URL: <http://code.djangoproject.com/ticket/7865>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---