Re: Nested Foreign Key relationships in Admin?
On 21/05/2012 1:57pm, Aditya Sriram M wrote:
> I'd like to represent foreign key relationships inside the Admin
> interface when there are multiple nested one-to-many relationships.
Provided you have the admin app enabled, in your admin.py in the same
directory as your models.py file you need some nested classes ...
class RootAdmin(admin.ModelAdmin):
# any ModelAdmin options
class Model2Admin(admin.TabularInline): # or admin.StackedInline
# any TabularInline options
class Model3Admin(admin..TabularInline): # or
admin.StackedInline
# any TabularInline options
... which ought to give you a nested view of Model2 when you examine
Root in the admin and a nested view of Model3 inside Model2. You can use
whatever options are listed in the docs (see below) to control what
happens when displaying records in the Admin app..
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects
Mike
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home