Monday, March 14, 2011

Re: Chaining stacked inline

Hi,
back from my WE and still no answers.
Should I presume that what I want to do is impossible?

On 11 mar, 17:40, gontran <geoffroydecorb...@gmail.com> wrote:
> Hi,
>
> I'm wondering if it's possible to chain StackedInlined object in a
> django admin page.
> Let me explain it:
> I have a class UserProfile which is linked by a OneToOneField to the
> django auth module class User. By this way (which is recommended) I
> store additionnal informations about my users. In those informations,
> I have a ForeignKey to the school of the user.
> With a StackedInline class, I can edit user's profile in a user admin
> page but I also want to be able to edit the school of a inside this
> page, not with a pop-up.
>
> Is it possible to achieve this?
>
> Just to sum-up:
>
> My model:
> Class UserProfile(models.Model):
>     user  = models.OneToOneField(User)
>                  ....extra fields....
>     school = models.ForeignKey(School)
>
> My admin.py:
> admin.site.unregister(User)
>
> class UserProfileInline(admin.StackedInline):
>
>     model = UserProfile
>
> class UserProfileAdmin(UserAdmin):
>
>     inlines = [UserProfileInline]
>
> admin.site.register(User, UserProfileAdmin)
>
> Thank you for your help

--
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


Real Estate