Esempio n. 1
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='CustomerUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('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(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
                ('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, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('age', models.PositiveBigIntegerField(blank=True, null=True)),
                ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
                ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
    ]
Esempio n. 2
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('last_login',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='last login')),
                ('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(
                     error_messages={
                         'unique': 'A user with that username already exists.'
                     },
                     help_text=
                     'Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
                     max_length=150,
                     unique=True,
                     validators=[
                         django.contrib.auth.validators.
                         UnicodeUsernameValidator()
                     ],
                     verbose_name='username')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='last name')),
                ('email',
                 models.EmailField(blank=True,
                                   max_length=254,
                                   verbose_name='email address')),
                ('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,
                     help_text=
                     'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
                     verbose_name='active')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('create_at',
                 models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_at',
                 models.DateTimeField(auto_now=True, verbose_name='修改时间')),
                ('name', models.CharField(max_length=20, verbose_name='姓名')),
                ('gender',
                 models.IntegerField(choices=[(0, '男'), (1, '女')],
                                     verbose_name='性别')),
                ('role',
                 models.IntegerField(choices=[(0, '学生'), (1, '教师')],
                                     verbose_name='角色')),
                ('school', models.CharField(max_length=30, verbose_name='学校')),
                ('age',
                 models.PositiveIntegerField(blank=True, verbose_name='年龄')),
                ('grade',
                 models.CharField(blank=True, max_length=10,
                                  verbose_name='年级')),
                ('class_name',
                 models.CharField(blank=True, max_length=20,
                                  verbose_name='班级')),
                ('telephone',
                 models.CharField(blank=True, max_length=15,
                                  verbose_name='电话')),
                ('title', models.CharField(max_length=20, verbose_name='职称')),
            ],
            options={
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Course',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('create_at',
                 models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_at',
                 models.DateTimeField(auto_now=True, verbose_name='修改时间')),
                ('name', models.CharField(max_length=64, verbose_name='课程名称')),
                ('start_date', models.DateTimeField(verbose_name='开始时间')),
                ('end_date', models.DateTimeField(verbose_name='结束时间')),
                ('points', models.FloatField(default=0.0, verbose_name='学分')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Homework',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('create_at',
                 models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_at',
                 models.DateTimeField(auto_now=True, verbose_name='修改时间')),
                ('available_since', models.DateTimeField(verbose_name='可用时间')),
                ('deadline', models.DateTimeField(verbose_name='截止时间')),
                ('status',
                 models.IntegerField(choices=[(0, '已锁定'), (1, '开放提交'),
                                              (2, '已截止')],
                                     verbose_name='状态')),
                ('total_score', models.FloatField(verbose_name='总分')),
                ('name', models.CharField(max_length=100,
                                          verbose_name='作业名称')),
                ('description',
                 django.contrib.postgres.fields.ArrayField(
                     base_field=models.TextField(),
                     default=list,
                     size=None,
                     verbose_name='作业描述')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Media',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('create_at',
                 models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_at',
                 models.DateTimeField(auto_now=True, verbose_name='修改时间')),
                ('token',
                 models.UUIDField(db_index=True,
                                  default=uuid.uuid4,
                                  verbose_name='token')),
                ('filename', models.CharField(max_length=64,
                                              verbose_name='文件名')),
                ('size', models.PositiveBigIntegerField(verbose_name='文件大小')),
                ('file', models.FileField(upload_to='files',
                                          verbose_name='文件')),
                ('mime',
                 models.CharField(max_length=64, verbose_name='MIME-Type')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='HomeworkSubmit',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('create_at',
                 models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_at',
                 models.DateTimeField(auto_now=True, verbose_name='修改时间')),
                ('description',
                 django.contrib.postgres.fields.ArrayField(
                     base_field=models.TextField(),
                     size=None,
                     verbose_name='作业提交描述')),
                ('score', models.FloatField(default=0.0, verbose_name='得分')),
                ('review',
                 django.contrib.postgres.fields.ArrayField(
                     base_field=models.TextField(),
                     default=list,
                     size=None,
                     verbose_name='评语')),
                ('reviewed',
                 models.BooleanField(default=False, verbose_name='是否批阅')),
                ('attachments',
                 models.ManyToManyField(to='cloudhomework.Media',
                                        verbose_name='作业提交附件')),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='提交者')),
                ('homework',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='submits',
                                   to='cloudhomework.homework',
                                   verbose_name='所属作业')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='homework',
            name='attachments',
            field=models.ManyToManyField(to='cloudhomework.Media',
                                         verbose_name='作业附件'),
        ),
        migrations.AddField(
            model_name='homework',
            name='course',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='homeworks',
                to='cloudhomework.course',
                verbose_name='所属课程'),
        ),
        migrations.AddField(
            model_name='course',
            name='cover',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='cloudhomework.media',
                verbose_name='课程封面'),
        ),
        migrations.AddField(
            model_name='course',
            name='students',
            field=models.ManyToManyField(related_name='selected_courses',
                                         to=settings.AUTH_USER_MODEL,
                                         verbose_name='选修学生'),
        ),
        migrations.AddField(
            model_name='course',
            name='teacher',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='opened_courses',
                to=settings.AUTH_USER_MODEL,
                verbose_name='教师'),
        ),
        migrations.AddField(
            model_name='user',
            name='avatar',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='cloudhomework.media',
                verbose_name='头像'),
        ),
        migrations.AddField(
            model_name='user',
            name='groups',
            field=models.ManyToManyField(
                blank=True,
                help_text=
                'The groups this user belongs to. A user will get all permissions granted to each of their groups.',
                related_name='user_set',
                related_query_name='user',
                to='auth.Group',
                verbose_name='groups'),
        ),
        migrations.AddField(
            model_name='user',
            name='user_permissions',
            field=models.ManyToManyField(
                blank=True,
                help_text='Specific permissions for this user.',
                related_name='user_set',
                related_query_name='user',
                to='auth.Permission',
                verbose_name='user permissions'),
        ),
    ]
Esempio n. 3
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Area',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name',
                 models.CharField(help_text='Наименование', max_length=250)),
                ('is_deleted', models.BooleanField(default=False)),
                ('type',
                 models.CharField(choices=[('cow', 'Коворкинг'),
                                           ('flr', 'Этаж')],
                                  default='cow',
                                  help_text='Тип площадки',
                                  max_length=3)),
                ('map_url',
                 models.CharField(help_text='Карта площадки', max_length=100)),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
        ),
        migrations.CreateModel(
            name='Company',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name',
                 models.CharField(help_text='Наименование', max_length=250)),
                ('is_deleted', models.BooleanField(default=False)),
                ('short_name',
                 models.CharField(help_text='Короткое наименование',
                                  max_length=100)),
                ('full_name',
                 models.CharField(help_text='Полное наименование',
                                  max_length=250)),
                ('code',
                 models.PositiveBigIntegerField(default=0,
                                                help_text='Код ЦФО')),
                ('root_dir',
                 models.CharField(help_text='Каталог со статикой',
                                  max_length=100)),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
        ),
        migrations.CreateModel(
            name='Resource',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name',
                 models.CharField(help_text='Наименование', max_length=250)),
                ('is_deleted', models.BooleanField(default=False)),
                ('type',
                 models.CharField(blank=True,
                                  choices=[('seat', 'Рабочее место'),
                                           ('room', 'Переговорная'),
                                           ('room', 'Ячейка хранения')],
                                  help_text='Тип ресурса',
                                  max_length=4,
                                  null=True)),
                ('area',
                 models.ForeignKey(blank=True,
                                   default=None,
                                   help_text='Родительская площадка',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='main.area')),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
        ),
        migrations.CreateModel(
            name='Cell',
            fields=[
                ('resource_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='main.resource')),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
            bases=('main.resource', ),
        ),
        migrations.CreateModel(
            name='Room',
            fields=[
                ('resource_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='main.resource')),
                ('location',
                 models.TextField(blank=True,
                                  help_text='Описание расположения',
                                  null=True)),
                ('description',
                 models.TextField(blank=True,
                                  help_text='Общее описание',
                                  null=True)),
                ('capacity',
                 models.SmallIntegerField(
                     default=0, help_text='Количество сидячих мест')),
                ('has_av',
                 models.BooleanField(
                     default=False,
                     help_text='Наличие аудио/видео аппаратуры')),
                ('has_phone',
                 models.BooleanField(default=False,
                                     help_text='Наличие телефона')),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
            bases=('main.resource', ),
        ),
        migrations.CreateModel(
            name='Task',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name',
                 models.CharField(help_text='Наименование', max_length=250)),
                ('is_deleted', models.BooleanField(default=False)),
                ('created_at',
                 models.DateTimeField(auto_now_add=True,
                                      help_text='Время создания')),
                ('created_by',
                 models.CharField(default='',
                                  help_text='Кем создано',
                                  max_length=50)),
                ('type',
                 models.CharField(choices=[('user', 'Запрос пользователя'),
                                           ('shed', 'Плановая задача')],
                                  default='user',
                                  help_text='Тип задачи',
                                  max_length=4)),
                ('message',
                 models.CharField(help_text='Сообщение', max_length=500)),
                ('is_active', models.BooleanField(blank=True, default=True)),
                ('resource',
                 models.ForeignKey(blank=True,
                                   default=None,
                                   help_text='Объект запроса',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='main.resource')),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
        ),
        migrations.CreateModel(
            name='Notification',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name',
                 models.CharField(help_text='Наименование', max_length=250)),
                ('is_deleted', models.BooleanField(default=False)),
                ('message',
                 models.CharField(help_text='Сообщение', max_length=500)),
                ('start',
                 models.DateTimeField(blank=True, help_text='Начало брони')),
                ('finish',
                 models.DateTimeField(blank=True,
                                      help_text='Окончание брони')),
                ('is_active', models.BooleanField(blank=True, default=True)),
                ('users_group',
                 models.ForeignKey(blank=True,
                                   default=None,
                                   help_text='Группа',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='auth.group')),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
        ),
        migrations.CreateModel(
            name='ExtUser',
            fields=[
                ('user_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='auth.user')),
                ('middle_name',
                 models.CharField(help_text='Отчество', max_length=500)),
                ('company',
                 models.ForeignKey(blank=True,
                                   default=None,
                                   help_text='Компания',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='main.company')),
                ('def_area',
                 models.ForeignKey(blank=True,
                                   default=None,
                                   help_text='Площадка по умолчанию',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='main.area')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            bases=('auth.user', ),
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name',
                 models.CharField(help_text='Наименование', max_length=250)),
                ('is_deleted', models.BooleanField(default=False)),
                ('description',
                 models.CharField(help_text='Описание', max_length=500)),
                ('users',
                 models.ManyToManyField(blank=True,
                                        default=None,
                                        help_text='Участники',
                                        to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
        ),
        migrations.CreateModel(
            name='Booking',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name',
                 models.CharField(help_text='Наименование', max_length=250)),
                ('is_deleted', models.BooleanField(default=False)),
                ('created_at',
                 models.DateTimeField(auto_now_add=True,
                                      help_text='Время создания')),
                ('created_by',
                 models.CharField(default='',
                                  help_text='Кем создано',
                                  max_length=50)),
                ('changed_at',
                 models.DateTimeField(auto_now=True,
                                      help_text='Время изменения')),
                ('changed_by',
                 models.CharField(default='',
                                  help_text='Кем изменено',
                                  max_length=50)),
                ('start_ts', models.DateTimeField(help_text='Начало брони')),
                ('end_ts', models.DateTimeField(help_text='Окончание брони')),
                ('is_confirmed',
                 models.BooleanField(blank=True,
                                     default=False,
                                     help_text='Подтверждение брони')),
                ('confirmed_at',
                 models.DateTimeField(blank=True,
                                      help_text='Время изменения',
                                      null=True)),
                ('confirmed_by',
                 models.CharField(blank=True,
                                  default='',
                                  help_text='Кем подтверждено',
                                  max_length=50,
                                  null=True)),
                ('pin',
                 models.PositiveSmallIntegerField(default=main.utils.get_pin,
                                                  help_text='PIN-код')),
                ('is_active', models.BooleanField(blank=True, default=True)),
                ('event',
                 models.ForeignKey(blank=True,
                                   default=None,
                                   help_text='Событие',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='main.event')),
                ('resource',
                 models.ForeignKey(blank=True,
                                   default=None,
                                   help_text='Объект бронирования',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='main.resource')),
                ('user',
                 models.ForeignKey(default=None,
                                   help_text='Бронирующий',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
        ),
        migrations.AddField(
            model_name='area',
            name='company',
            field=models.ForeignKey(
                blank=True,
                default=None,
                help_text='Компания',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='main.company'),
        ),
        migrations.CreateModel(
            name='Seat',
            fields=[
                ('resource_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='main.resource')),
                ('status',
                 models.CharField(choices=[('available', 'Доступно'),
                                           ('unavailable', 'Недоступно'),
                                           ('unavailable', 'Недоступно')],
                                  default='available',
                                  help_text='Статус места',
                                  max_length=11)),
                ('owner',
                 models.ForeignKey(blank=True,
                                   default=None,
                                   help_text='За кем закреплено',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
            bases=('main.resource', ),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='Room',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('buy_in_range',
                 django.contrib.postgres.fields.ranges.BigIntegerRangeField()),
                ('seating_count',
                 models.PositiveBigIntegerField(
                     choices=[(2, 'Heads-Up'), (3, '3-Max'), (
                         4, '4-Max'), (6, '6-Max'), (9, '9-Max')])),
                ('speed',
                 models.CharField(choices=[('S', 'Slow'), ('F', 'Fast')],
                                  max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Player',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('last_login',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='last login')),
                ('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(
                     error_messages={
                         'unique': 'A user with that username already exists.'
                     },
                     help_text=
                     'Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
                     max_length=150,
                     unique=True,
                     validators=[
                         django.contrib.auth.validators.
                         UnicodeUsernameValidator()
                     ],
                     verbose_name='username')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='last name')),
                ('email',
                 models.EmailField(blank=True,
                                   max_length=254,
                                   verbose_name='email address')),
                ('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,
                     help_text=
                     'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
                     verbose_name='active')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('avatar',
                 models.ImageField(blank=True,
                                   upload_to=functools.partial(
                                       gamemaster.utils.get_upload_path,
                                       *('avatars', ), **{}),
                                   validators=[
                                       functools.partial(
                                           gamemaster.utils.validate_file_size,
                                           *(10, ), **{})
                                   ])),
                ('description', models.TextField(blank=True)),
                ('payoff', models.BigIntegerField(default=0)),
                ('play_count', models.PositiveBigIntegerField(default=0)),
                ('groups',
                 models.ManyToManyField(
                     blank=True,
                     help_text=
                     'The groups this user belongs to. A user will get all permissions granted to each of their groups.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Group',
                     verbose_name='groups')),
                ('user_permissions',
                 models.ManyToManyField(
                     blank=True,
                     help_text='Specific permissions for this user.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Permission',
                     verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
    ]
Esempio n. 5
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('username', models.CharField(help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, primary_key=True, serialize=False)),
                ('email', models.EmailField(max_length=254)),
                ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
                ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Currency',
            fields=[
                ('title', models.CharField(max_length=12, primary_key=True, serialize=False)),
            ],
        ),
        migrations.CreateModel(
            name='Wallet',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('wallet', models.FloatField(blank=True, default=0, help_text='User wallet', null=True, validators=[django.core.validators.MinValueValidator(0.0)])),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.RESTRICT, to='order.currency')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.RESTRICT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'unique_together': {('user', 'currency')},
            },
        ),
        migrations.AddField(
            model_name='currency',
            name='wallets',
            field=models.ManyToManyField(through='order.Wallet', to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('amount', models.FloatField()),
                ('success', models.BooleanField(blank=True, null=True)),
                ('reason', models.CharField(blank=True, max_length=512, null=True)),
                ('unique_key', models.PositiveBigIntegerField(unique=True)),
                ('published', models.BooleanField(default=False)),
                ('currency_from', models.ForeignKey(on_delete=django.db.models.deletion.RESTRICT, related_name='currency_from', to='order.currency')),
                ('currency_to', models.ForeignKey(on_delete=django.db.models.deletion.RESTRICT, related_name='currency_to', to='order.currency')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.RESTRICT, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'unique_together': {('user', 'unique_key', 'currency_from', 'currency_to', 'amount')},
            },
        ),
        migrations.RunPython(prefill_db),
    ]