On Nov 15, 2017 8:18 PM, "Mike Dewhirst" <mi...@dewhirst.com.au> wrote:

Any hints appreciated. I'm stumped. Traceback at the end.

Many thanks

Mike

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -

I have a custom user based on AbstractUser plus a UserProfile model as
follows:

#common.models
from django.conf import settings
from django.contrib.auth.models import AbstractUser, Group, UserManager
from django.db import models
from django.utils.encoding import python_2_unicode_compatible


@python_2_unicode_compatible
class User(AbstractUser):

    objects = UserManager()

    class Meta:
        abstract = False


Dumb question. I'm assuming you've set AUTH_USER_MODEL to use your new user
model?

Also, the Django contrib user model has a meta option for swappable,
perhaps you need to set that since you are overriding the Meta class?

class Meta:
    abstract = False
    swappable = True


Your Meta could also inherit from AbstractUser.Meta. Or better yet, since
abstract = False by default, just remove the entire Meta class and let the
defaults reign.

I have seen several tickets where the devs are playing with this option,
calling it a 'stealth new feature' and leaving it undocumented
intentionally, but it has something to do with changing out the user model
on existing projects.

-James

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUZ4fThf2wc25eMaENAh58vvBU-YuYJ1hBUBAFE1%3DRZ7g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to