I've personally used your approach with the following Inline:

class UserProfile2Inline(admin.StackedInline):
    model = UserProfile2
    can_delete = False
    fk_name = 'user'
    max_num = 1

Andrea


2014-08-14 5:57 GMT+02:00 Elliot <elliotgilm...@gmail.com>:

> Is it possible to have a exteneded user profile in the 'User' part of the
> admin. I have tried the following with a form
> (UserProfileForm(forms.ModelForm)) with 2 fields 'something' and 'something
> else'
>
> class UserAdminCustom(UserAdmin):
>     form = UserProfileForm
>      fieldsets = (
>          (None, {'fields': ('username', 'password', 'something',
> 'something_else')}),
>          ('Personal info', {'fields': ('first_name', 'last_name',
> 'email')}),
>          ('Permissions', {'fields': ('is_staff', 'is_active',
> 'is_superuser', 'user_permissions')}),
>          ('Important dates', {'fields': ('last_login', 'date_joined')}),
>          ('Groups', {'fields': ('groups',)}),
>      )
>
>
> admin.site.unregister(User)
> admin.site.register(User, UserAdminCustom)
>
> What it results in is the 2 new fields as expected in the User in admin
> but the fields are empty and it saves nothing to these fields on save.
>
> Is the only option to use inlines, like below, or am I just missing
> something.
>
> class UserProfile2Inline(admin.StackedInline):
>     model = UserProfile2
>
> class UserAdminCustom(UserAdmin):
>     inlines = (UserProfile2Inline,)
>
> admin.site.unregister(User)
> admin.site.register(User, UserAdminCustom)
>
> Cheers if someone can shed some light on this for me.
>
> Elliot
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/825615e1-e364-4a60-94de-e7abde68b409%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/825615e1-e364-4a60-94de-e7abde68b409%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAPQ7Y0aYYJigFGNDQkOqqThg-eMKdB57yQA7KrDHtgUZrySJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to