I am getting below error when I try to run makemigrations command.
TypeError: CustomerProxy cannot proxy the swapped model 'accounts.User'.
I am using custom user model so I think it might be an issue because of that.
Full StackTrace:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/core/management/commands/makemigrations.py", line 132, in handle
migration_name=self.migration_name,
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/db/migrations/autodetector.py", line 46, in changes
changes = self._detect_changes(convert_apps, graph)
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/db/migrations/autodetector.py", line 131, in _detect_changes
self.old_apps = self.from_state.concrete_apps
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/db/migrations/state.py", line 166, in concrete_apps
self.apps = StateApps(self.real_apps, self.models, ignore_swappable=True)
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/db/migrations/state.py", line 228, in __init__
self.render_multiple(list(models.values()) + self.real_models)
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/db/migrations/state.py", line 296, in render_multiple
model.render(self)
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/db/migrations/state.py", line 585, in render
body,
File "/Users/hamza/.virtualenvs/localites/lib/python2.7/site-packages/django/db/models/base.py", line 142, in __new__
raise TypeError("%s cannot proxy the swapped model '%s'." % (name, base_meta.swapped))
TypeError: CustomerProxy cannot proxy the swapped model 'accounts.User'.
Installed Apps:
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'formtools',
# my apps
'account',
'apps.accounts',
'apps.services',
'social.apps.django_app.default',
# django-cms and it's dependecies
'cms',
'treebeard',
'menus',
'sekizai',
'djangocms_admin_style',
'djangocms_text_ckeditor',
'filer',
'easy_thumbnails',
'easy_thumbnails.optimize',
'post_office',
'shop',
'apps.myshop',
]
Custom user model in accounts.models:
class User(AbstractBaseUser, PermissionsMixin):
first_name = models.CharField(max_length=30, verbose_name=_('First Name'), blank=True, null=True)
last_name = models.CharField(max_length=30, verbose_name=_('Last Name'), blank=True, null=True)
email = models.EmailField(verbose_name=_('Email Address'), unique=True)
date_of_birth = models.DateField(verbose_name="Date of Birth", blank=True, null=True)
is_active = models.BooleanField(default=False)
is_staff = models.BooleanField(default=False)
# is_superuser = models.BooleanField(default=False)
# group = models.ForeignKey(Group, on_delete=models.CASCADE, default=1)
username = models.CharField(
_('username'),
max_length=30,
unique=True,
help_text=_('Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.'),
validators=[
validators.RegexValidator(
r'^[\w.@+-]+$',
_('Enter a valid username. This value may contain only '
'letters, numbers ' 'and @/./+/-/_ characters.')
),
],
error_messages={
'unique': _("A user with that username already exists."),
},
)
date_joined = models.DateTimeField(_('date joined'), default=timezone.now)
objects = UserManager()
class Meta:
swappable = 'AUTH_USER_MODEL'
db_table = 'accounts_user'
verbose_name = _("Customer")
verbose_name_plural = _("Customers")
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []