Opened 9 years ago
Closed 9 years ago
#27780 closed Bug (invalid)
makemigrations on custom user model
| Reported by: | Roman Vasilyev | Owned by: | nobody |
|---|---|---|---|
| Component: | Migrations | Version: | 1.10 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Getting error on django 1.10.5 running manage makemigraions
./manage.py makemigrations
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/makemigrations.py", line 149, in handle
loader.project_state(),
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/loader.py", line 317, in project_state
return self.graph.make_state(nodes=nodes, at_end=at_end, real_apps=list(self.unmigrated_apps))
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/graph.py", line 409, in make_state
project_state = self.nodes[node].mutate_state(project_state, preserve=False)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/migration.py", line 92, in mutate_state
operation.state_forwards(self.app_label, new_state)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/operations/models.py", line 330, in state_forwards
for name, field in state.models[related_key].fields:
KeyError: ('account', 'user')
revert to 1.9.12 works fine
my User model:
@python_2_unicode_compatible
class User(AbstractBaseUser, PermissionsMixin):
t_token = None
public_id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
email = LowercaseEmailField(_('email'), blank=False, unique=True)
first_name = models.CharField(_('first name'), max_length=30, blank=False)
last_name = models.CharField(_('last name'), max_length=30, blank=False)
activated = models.DateTimeField(_('date activated'), blank=True, null=True, default=None)
date_joined = models.DateTimeField(_('date joined'), default=timezone.now)
is_staff = models.BooleanField(_('staff status'), default=False,
help_text=_('Designates whether the user can log into this admin '
'site.'))
is_active = models.BooleanField(_('active'), default=False,
help_text=_('Designates whether this user should be treated as '
'active. Unselect this instead of deleting accounts.'))
is_eligible = models.BooleanField(_('eligible'), default=True,
help_text=_('Eligible users, cna be revoked for for spam, aggressive '
'behavior, fishing links.'))
is_smtp = models.BooleanField(_('SMTP'), default=True,
help_text=_('Email sending status during delivery.'))
is_happy = models.BooleanField(_('want emails'), default=True,
help_text=_('Can send to this email, person may revoke this.'))
is_exported = models.BooleanField(_('external account'), default=False,
help_text=_('Created by external login.'))
chat_notifications = models.BooleanField(_('chat notification'), default=True)
slug = AutoSlugField( populate_from='get_full_name', unique=True)
GENDER_CHOICES = (
('M', 'Male'),
('F', 'Female'),
)
gender = models.CharField(max_length=1, choices=GENDER_CHOICES, null=True, blank=True)
birthday = models.DateField(blank=True, null=True)
picture = sorl_thumbnail.ImageField(upload_to='user',
blank=True,
verbose_name=_("Profile picture"),
)
background = sorl_thumbnail.ImageField(upload_to='user',
blank=True,
verbose_name=_("Profile background"),
)
api_key = models.CharField(max_length=48, unique=True)
connections = models.ManyToManyField('self', symmetrical=True)
following_users = models.ManyToManyField('self', symmetrical=False, related_name='followers')
following_business = models.ManyToManyField('Business', related_name='followers')
objects = UserQuerySet.as_manager()
USERNAME_FIELD = 'email'
class Meta:
ordering = ['-pk']
verbose_name = _('user')
verbose_name_plural = _('users')
Change History (3)
comment:1 by , 9 years ago
| Component: | Uncategorized → Migrations |
|---|
comment:2 by , 9 years ago
During project preparation found that problem was in not updated django push notifications project, after update everything went fine.
Sorry for creating false alarm.
comment:3 by , 9 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Could you please provide a minimal sample project to reproduce the issue?