Hi,
You need to unregister `User` model from admin site before registering new one.
admin.site.unregister(User)
admin.site.register(CustomUser, UserAdmin)
Please have a look at http://stackoverflow.com/a/2270704/353550
Pankaj Singh
http://about.me/psjinx
On Mon, Nov 26, 2012 at 9:14 PM, Benoit Petit
<benoit.petit.info@gmail.com> wrote:
> Hi,
>
> I extend the django user model as described in the dev doc. I wan't to keep
> most of the original User model features so I extend the AbstractUser class.
> I've defined in settings.py:
>
> AUTH_USER_MODEL = 'myapp.CustomUser'
>
> My user class:
>
> class CustomUser(AbstractUser):
> custom_field = models.ForeignKey('OtherModel')
> objects = UserManager()
>
> Everything seems to work fine but when I try to make it managed by the admin
> site:
>
> admin.site.register(CustomUser, UserAdmin)
>
> I get this error on the admin CustomUser creation page (after validation of
> the password confirmation form):
>
> AttributeError: Manager isn't available; User has been swapped for
> 'myapp.CustomUser'
>
> The point is that I need this model managed by the admin site in order to
> have the same creation process as with the original User model (two step
> process with password validation).
>
> Thanks for any reply
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/8VtQghtcMFgJ.
> 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.
--
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment