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: nbe...@gmail.com
> 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: django-users@googlegroups.com
>
> 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 :
> > 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: 술욱
> >> 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
> >>
> >>
> >> 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
> >> 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