ModelAdmin - related foreign keys

3 views
Skip to first unread message

Ogi Vranesic

unread,
Feb 9, 2010, 5:03:44 PM2/9/10
to django...@googlegroups.com
Hi
I'm new in Django and want to explain my issue:

For instance I have model A with foreign key to B
and model B with foreign key to C.
I would like to have add form of C with
one B (extra = 1) and within B four A (extra = 4)

With the following example in admin.py I can only achieve this partly:
for object C I have only extra B object without A objects related to B object.

class AInline(admin.TabularInline):

model = A
extra = 4

class BAdmin(admin.ModelAdmin):

inlines = [AInline]

class BInline(admin.TabularInline):

model = B
extra = 1

class CAdmin(admin.ModelAdmin):

inlines = [BInline]

So can somebody explain me how to do dies, that I can have complete add-form
inside the object C: with extra object B together with extra (sub)objects C ?

Excuse me for bad english and lot of text.
Thanks in advance for any hint.
Best regards
Ogi

Reply all
Reply to author
Forward
0 new messages