Thursday, October 19, 2017

Re: Django 1.5 custom User model error. "Manager isn't available; User has been swapped"

hey,

I am facing similar issue. You said here is solution I checked. .nothing related

On Wednesday, November 28, 2012 at 1:37:39 PM UTC+5:30, bpetit wrote:
Thanks for reply but this solutions doesn't seem to work. I've found a solution that is explained here.

Regards

On Tuesday, November 27, 2012 5:52:09 AM UTC+1, psjinx wrote:
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.p...@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...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@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 unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ffa92f31-776a-4365-922c-3303c5350ea9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment