Re: InlineModelAdmin related items on two levels

2010-02-14 Thread Ogi Vranesic
>>On Feb 14, 6:19 am, Ogi Vranesic  wrote:
>> Hi all
>>
>> I read the very good tutorial 
onhttp://docs.djangoproject.com/en/dev/ref/contrib/admin/
>> and understood that the admin interface has the ability to edit models on 
the
>> same page as a parent model and these are called inlines. For two related
>> models is this easy:
>>
>> class A (models.Model):
>>name =...
>>
>> class B(models.Model):
>>a = models.ForeignKey(A)
>>title = ...
>>
>> in admin.py:
>>
>> class B(admin.TabularInline):
> >model = B
>>
>> class AAdmin(admin.ModelAdmin):
>> inlines = [
>> B,
>> ]
>>
>> and the result ist, that in add/change of A we can also add/change its 
child
>> models B
>>
>> My Problem is   that I however by B model have also child models:
>> class C
> >  b = models.ForeignKey(B)
>>   name = ...
>>
>> My Question is :
>> Is it possible than one can add/edit models of A on the one page together 
with
>> child models B and C as child models of B.
>>
>> Any hint or idee would be very appreciated

>Sounds like you want nested inlines. There is no built-in way to do
>this with django. I did some work (and got a solution working), but it
>required significant change to the installed django. I was planning on
>trying to make it into an installable app, but didn't get far.

>I do have a diff: I've just put it at http://pastie.org/823968 - this
>is with a fairly old trunk though, so it may not merge back in that
>well right now.

>It was based on another nested-inline diff I had come across, but I
>don't seem to have the link any more.

>Oh, and it is not flawless, there were still some issues I didn't get
>sorted out. I had some validation errors of some sort, I think, when
>updating data under certain circumstances, but I never quite
>completely tracked it down.

> Matt.

Hi Matt

Thank you very much for Your reply and effort to manage this issue.
It's pitty, that nested lists are not implemented in django.
I'll look Your diffs on http://pastie.org/823968 and try to do something.

Best regards
Ogi

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: InlineModelAdmin related items on two levels

2010-02-13 Thread Matt Schinckel
Oh, and it is not flawless, there were still some issues I didn't get
sorted out. I had some validation errors of some sort, I think, when
updating data under certain circumstances, but I never quite
completely tracked it down.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: InlineModelAdmin related items on two levels

2010-02-13 Thread Matt Schinckel
On Feb 14, 6:19 am, Ogi Vranesic  wrote:
> Hi all
>
> I read the very good tutorial 
> onhttp://docs.djangoproject.com/en/dev/ref/contrib/admin/
> and understood that the admin interface has the ability to edit models on the
> same page as a parent model and these are called inlines. For two related
> models is this easy:
>
> class A (models.Model):
>    name =...
>
> class B(models.Model):
>    a = models.ForeignKey(A)
>    title = ...
>
> in admin.py:
>
> class B(admin.TabularInline):
>     model = B
>
> class AAdmin(admin.ModelAdmin):
>     inlines = [
>         B,
>     ]
>
> and the result ist, that in add/change of A we can also add/change its child
> models B
>
> My Problem is   that I however by B model have also child models:
> class C
>   b = models.ForeignKey(B)
>   name = ...
>
> My Question is :
> Is it possible than one can add/edit models of A on the one page together with
> child models B and C as child models of B.
>
> Any hint or idee would be very appreciated

Sounds like you want nested inlines. There is no built-in way to do
this with django. I did some work (and got a solution working), but it
required significant change to the installed django. I was planning on
trying to make it into an installable app, but didn't get far.

I do have a diff: I've just put it at http://pastie.org/823968 - this
is with a fairly old trunk though, so it may not merge back in that
well right now.

It was based on another nested-inline diff I had come across, but I
don't seem to have the link any more.

Matt.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



InlineModelAdmin related items on two levels

2010-02-13 Thread Ogi Vranesic
Hi all

I read the very good tutorial on 
http://docs.djangoproject.com/en/dev/ref/contrib/admin/
and understood that the admin interface has the ability to edit models on the 
same page as a parent model and these are called inlines. For two related 
models is this easy:

class A (models.Model):
   name =...

class B(models.Model):
   a = models.ForeignKey(A)
   title = ...

in admin.py:

class B(admin.TabularInline):
model = B

class AAdmin(admin.ModelAdmin):
inlines = [
B,
]

and the result ist, that in add/change of A we can also add/change its child 
models B

My Problem is   that I however by B model have also child models: 
class C
  b = models.ForeignKey(B)
  name = ...

My Question is : 
Is it possible than one can add/edit models of A on the one page together with 
child models B and C as child models of B.

Any hint or idee would be very appreciated
Ogi

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.