Hello Norberto, In your first example, I think the name of your apps in the apps.py config file conflicts with the core Django auth module and it could explains the second exception you get.
When you use a custom model in Django, the "migrate" command always create additional table for group and user_permissions but they are never filled in throught the admin site. According to me, Django creates these tables but they are useless. Why ? I don't really know... Maybe it's depending on the table creation process. If you want to use group and permissions with your custom model, it will be stored in auth_group, auth_group_permissions and auth_permissions tables. Sorry, my answer doesn't really help you but that's is my understanding of custom user model process at this time. Sylvain. -- > From: [email protected] > Date: Wed, 14 Oct 2015 12:43:03 -0300 > Subject: Re: Django 1.8: subclass AbstractUser, App 'auth' doesn't have a > 'myuser' model. > To: [email protected] > > Hello Tim, > > yes, I need to use the custom user model. The app is now in production > (Django 1.6.11). > > If I use settings.AUTH_USER_MODEL = 'auth.MyUser', I get the error > described in my previous emails. > > If I change to settings.AUTH_USER_MODEL = 'myauth.MyUser', I get the > following tables created: > > myauth_myuser > myauth_myuser_groups > myauth_myuser_user_permissions > > Thanks, > Norberto > > > 2015-10-13 18:26 GMT-03:00 Tim Graham <[email protected]>: > > Do you want to use the custom user model or not? What extra tables are > > created? > > > > On Tuesday, October 13, 2015 at 1:31:03 PM UTC-7, Norberto Bensa wrote: > >> > >> Hello, > >> > >> I'm re-posting this. > >> > >> Note that I already tried AUTH_USER_MODEL = "myauth.MyUser', and while > >> that makes the problem disappear, the change also creates new tables > >> in the database. > >> > >> What are my options? AFAIK 1.6 is deprecated for security reasons and > >> I want to upgrade to 1.8.x. > >> > >> Thanks. > >> Norberto > >> > >> > >> > >> ---------- Forwarded message ---------- > >> From: 술욱 <[email protected]> > >> Date: 2015-10-06 22:37 GMT-03:00 > >> Subject: Django 1.8: subclass AbstractUser, App 'auth' doesn't have a > >> 'myuser' model. > >> To: 'Tom <[email protected]> > >> > >> > >> Hello, > >> > >> I'm trying to upgrade an app from Django 1.6 to 1.8 but I can't solve > >> a problem apparently related to a custom user model. > >> > >> The project has an 'auth' app with its corresponding models.py and > >> apps.py. The snippet pasted bellow reproduces the problem which I > >> don't know how to fix. > >> > >> Many TIA, > >> Norberto > >> > >> > >> # auth/models.py > >> from django.contrib.auth.models import AbstractUser > >> from django.db import models > >> > >> class MyUser(AbstractUser): > >> pass > >> > >> > >> # auth/apps.py > >> from django.apps import AppConfig > >> > >> class MyAuth(AppConfig): > >> name = 'auth' > >> label = 'myauth' > >> > >> > >> # project/setting.py > >> > >> INSTALLED_APPS = ( > >> ... > >> 'auth.apps.MyAuth', > >> ... > >> ) > >> > >> AUTH_USER_MODEL = 'auth.MyUser' > >> > >> > >> Note apps.py is there just because 'auth' collides with > >> django.contrib.auth. > >> > >> > >> $ ./manage.py makemigrations > >> Traceback (most recent call last): > >> File > >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/apps/config.py", > >> line 159, in get_model > >> return self.models[model_name.lower()] > >> KeyError: 'myuser' > >> > >> During handling of the above exception, another exception occurred: > >> > >> Traceback (most recent call last): > >> File "./manage.py", line 10, in <module> > >> execute_from_command_line(sys.argv) > >> File > >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/__init__.py", > >> line 351, in execute_from_command_line > >> utility.execute() > >> File > >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/__init__.py", > >> line 343, in execute > >> self.fetch_command(subcommand).run_from_argv(self.argv) > >> File > >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/base.py", > >> line 394, in run_from_argv > >> self.execute(*args, **cmd_options) > >> File > >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/base.py", > >> line 444, in execute > >> self.check() > >> File > >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/management/base.py", > >> line 482, in check > >> include_deployment_checks=include_deployment_checks, > >> File > >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/core/checks/registry.py", > >> line 72, in run_checks > >> new_errors = check(app_configs=app_configs) > >> File > >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/contrib/auth/checks.py", > >> line 12, in check_user_model > >> cls = apps.get_model(settings.AUTH_USER_MODEL) > >> File > >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/apps/registry.py", > >> line 202, in get_model > >> return self.get_app_config(app_label).get_model(model_name.lower()) > >> File > >> "/home/ubuntu/.virtualenvs/testauth/lib/python3.4/site-packages/django/apps/config.py", > >> line 162, in get_model > >> "App '%s' doesn't have a '%s' model." % (self.label, model_name)) > >> LookupError: App 'auth' doesn't have a 'myuser' model. > > > > -- > > 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 [email protected]. > > To post to this group, send email to [email protected]. > > 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/7f285c9a-6088-4615-8b68-342322ad89c7%40googlegroups.com. > > 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 [email protected]. > To post to this group, send email to [email protected]. > 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/CADut3oC13njTNzmbL%3DsteuJXxtZjsBmriDkPRVm7EJ27hDxgaA%40mail.gmail.com. > 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 [email protected]. To post to this group, send email to [email protected]. 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/DUB114-W88307E42F15EBBA1A065A5CA3F0%40phx.gbl. For more options, visit https://groups.google.com/d/optout.

