2015-01-28 20:35:27 +08:00
|
|
|
import django.contrib.auth.models
|
2016-04-23 01:39:13 +08:00
|
|
|
from django.contrib.auth import validators
|
2015-01-28 20:35:27 +08:00
|
|
|
from django.db import migrations, models
|
2016-12-01 18:38:01 +08:00
|
|
|
from django.utils import timezone
|
2014-06-17 03:59:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
('contenttypes', '__first__'),
|
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='Permission',
|
|
|
|
fields=[
|
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
|
('name', models.CharField(max_length=50, verbose_name='name')),
|
2015-07-22 22:43:21 +08:00
|
|
|
('content_type', models.ForeignKey(
|
|
|
|
to='contenttypes.ContentType',
|
|
|
|
on_delete=models.CASCADE,
|
|
|
|
to_field='id',
|
|
|
|
verbose_name='content type',
|
|
|
|
)),
|
2014-06-17 03:59:24 +08:00
|
|
|
('codename', models.CharField(max_length=100, verbose_name='codename')),
|
|
|
|
],
|
|
|
|
options={
|
2019-04-24 18:44:13 +08:00
|
|
|
'ordering': ['content_type__app_label', 'content_type__model', 'codename'],
|
2017-05-18 21:33:40 +08:00
|
|
|
'unique_together': {('content_type', 'codename')},
|
2014-06-17 03:59:24 +08:00
|
|
|
'verbose_name': 'permission',
|
|
|
|
'verbose_name_plural': 'permissions',
|
|
|
|
},
|
2014-12-13 06:19:58 +08:00
|
|
|
managers=[
|
|
|
|
('objects', django.contrib.auth.models.PermissionManager()),
|
|
|
|
],
|
2014-06-17 03:59:24 +08:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='Group',
|
|
|
|
fields=[
|
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
|
('name', models.CharField(unique=True, max_length=80, verbose_name='name')),
|
|
|
|
('permissions', models.ManyToManyField(to='auth.Permission', verbose_name='permissions', blank=True)),
|
|
|
|
],
|
|
|
|
options={
|
|
|
|
'verbose_name': 'group',
|
|
|
|
'verbose_name_plural': 'groups',
|
|
|
|
},
|
2014-12-13 06:19:58 +08:00
|
|
|
managers=[
|
|
|
|
('objects', django.contrib.auth.models.GroupManager()),
|
|
|
|
],
|
2014-06-17 03:59:24 +08:00
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
|
|
|
name='User',
|
|
|
|
fields=[
|
|
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
|
|
('password', models.CharField(max_length=128, verbose_name='password')),
|
|
|
|
('last_login', models.DateTimeField(default=timezone.now, verbose_name='last login')),
|
2015-09-12 07:33:12 +08:00
|
|
|
('is_superuser', models.BooleanField(
|
|
|
|
default=False,
|
|
|
|
help_text='Designates that this user has all permissions without explicitly assigning them.',
|
|
|
|
verbose_name='superuser status'
|
|
|
|
)),
|
|
|
|
('username', models.CharField(
|
|
|
|
help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True,
|
|
|
|
max_length=30, verbose_name='username',
|
2016-12-01 18:38:01 +08:00
|
|
|
validators=[validators.UnicodeUsernameValidator()],
|
2015-09-12 07:33:12 +08:00
|
|
|
)),
|
2014-06-17 03:59:24 +08:00
|
|
|
('first_name', models.CharField(max_length=30, verbose_name='first name', blank=True)),
|
|
|
|
('last_name', models.CharField(max_length=30, verbose_name='last name', blank=True)),
|
|
|
|
('email', models.EmailField(max_length=75, verbose_name='email address', blank=True)),
|
2015-09-12 07:33:12 +08:00
|
|
|
('is_staff', models.BooleanField(
|
|
|
|
default=False, help_text='Designates whether the user can log into this admin site.',
|
|
|
|
verbose_name='staff status'
|
|
|
|
)),
|
|
|
|
('is_active', models.BooleanField(
|
|
|
|
default=True, verbose_name='active', help_text=(
|
|
|
|
'Designates whether this user should be treated as active. Unselect this instead of deleting '
|
|
|
|
'accounts.'
|
|
|
|
)
|
|
|
|
)),
|
2014-06-17 03:59:24 +08:00
|
|
|
('date_joined', models.DateTimeField(default=timezone.now, verbose_name='date joined')),
|
2015-09-12 07:33:12 +08:00
|
|
|
('groups', models.ManyToManyField(
|
|
|
|
to='auth.Group', verbose_name='groups', blank=True, related_name='user_set',
|
|
|
|
related_query_name='user', help_text=(
|
|
|
|
'The groups this user belongs to. A user will get all permissions granted to each of their '
|
|
|
|
'groups.'
|
|
|
|
)
|
|
|
|
)),
|
|
|
|
('user_permissions', models.ManyToManyField(
|
|
|
|
to='auth.Permission', verbose_name='user permissions', blank=True,
|
|
|
|
help_text='Specific permissions for this user.', related_name='user_set',
|
|
|
|
related_query_name='user')
|
|
|
|
),
|
2014-06-17 03:59:24 +08:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
'swappable': 'AUTH_USER_MODEL',
|
|
|
|
'verbose_name': 'user',
|
|
|
|
'verbose_name_plural': 'users',
|
|
|
|
},
|
2014-12-13 06:19:58 +08:00
|
|
|
managers=[
|
|
|
|
('objects', django.contrib.auth.models.UserManager()),
|
|
|
|
],
|
2014-06-17 03:59:24 +08:00
|
|
|
),
|
|
|
|
]
|