Opened 12 years ago
Closed 12 years ago
#22562 closed Bug (worksforme)
Each call of makemigrations creates a migration for custom user account.
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Migrations | Version: | dev |
| Severity: | Release blocker | 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
DJANGO_APPS = (
'django.contrib.contenttypes',
#'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admindocs',
'django.contrib.humanize',
'django.contrib.sitemaps',
'django.contrib.flatpages',
)
EXTERNAL_APPS = (
'haystack',
'storages',
'pipeline',
'endless_pagination',
'easy_thumbnails',
'mptt',
'rest_framework',
'crispy_forms',
'crispy_forms_foundation',
'taggit',
)
SITE_APPS = (
'accounts',
# 'core',
# 'images',
# 'streams',
# 'links',
# 'entries',
)
INSTALLED_APPS = DJANGO_APPS + EXTERNAL_APPS + SITE_APPS
AUTH_USER_MODEL = 'accounts.User'
models.py:
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
class User(AbstractUser):
description = models.TextField(null=True, blank=True, verbose_name=u"Write something about yourself")
link_blank = models.BooleanField(default=False, verbose_name=u"Open links in new window")
link_direct = models.BooleanField(default=False, verbose_name=u"Skip directly to the link")
class Meta:
db_table = 'auth_user'
def get_absolute_url(self):
return reverse("user:detail", kwargs={'pk': self.pk})
def get_edit_url(self):
return reverse("user:edit", kwargs={'pk': self.pk})
migrations: 0001_initial 0002_auto_20140502_1656 0003_auto_20140502_1703 0004_auto_20140502_1703
0001_initial
# encoding: utf8
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
(b'auth', b'__first__'),
]
operations = [
migrations.CreateModel(
name=b'User',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
(b'password', models.CharField(max_length=128, verbose_name='password')),
(b'last_login', models.DateTimeField(default=django.utils.timezone.now, verbose_name='last login')),
(b'is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
(b'username', models.CharField(help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True, max_length=30, verbose_name='username', validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username.', 'invalid')])),
(b'first_name', models.CharField(max_length=30, verbose_name='first name', blank=True)),
(b'last_name', models.CharField(max_length=30, verbose_name='last name', blank=True)),
(b'email', models.EmailField(max_length=75, verbose_name='email address', blank=True)),
(b'is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
(b'is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
(b'date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
(b'description', models.TextField(null=True, verbose_name='Write something about yourself', blank=True)),
(b'link_blank', models.BooleanField(default=False, verbose_name='Open links in new window')),
(b'link_direct', models.BooleanField(default=False, verbose_name='Skip directly to the link')),
(b'groups', models.ManyToManyField(to=b'auth.Group', verbose_name='groups', blank=True)),
(b'user_permissions', models.ManyToManyField(to=b'auth.Permission', verbose_name='user permissions', blank=True)),
],
options={
'abstract': False,
'verbose_name': 'user',
'verbose_name_plural': 'users',
},
bases=(models.Model,),
),
]
0002_auto_20140502_1656 - 0004_auto_20140502_1703
# encoding: utf8
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
(b'accounts', b'0001_initial'),
]
operations = [
migrations.AlterField(
model_name=b'user',
name=b'username',
field=models.CharField(help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True, max_length=30, verbose_name='username', validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username.', 'invalid')]),
),
]
Each migration applies correctly but it does not change anything when you enter manage.py makemigrations.
Change History (4)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Yeah,
I did uninstall django and installed it by
pip install git+https://github.com/django/django@stable/1.7.x
comment:3 by , 12 years ago
Could you try again? I can't reproduce this issue with the model you provided:
$ python manage.py makemigrations accounts No changes detected in app 'accounts'
The initial migration that was generated for me only has
options={
'db_table': 'auth_user',
},
Note:
See TracTickets
for help on using tickets.
You are using the latest master? This was reported in #21638 but subsequently fixed.