class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    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')),
                ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('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')),
                ('email', models.EmailField(max_length=254, unique=True)),
                ('username', models.CharField(error_messages={'unique': 'Пользователь с таким username уже существует.'}, max_length=50, unique=True, verbose_name='Логин')),
                ('role', models.CharField(choices=[('USR', 'User'), ('ADM', 'Admin')], default='USR', max_length=8)),
                ('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='Follow',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='followers', to=settings.AUTH_USER_MODEL)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='follow', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'follow',
                'verbose_name_plural': 'follows',
            },
        ),
        migrations.AddConstraint(
            model_name='follow',
            constraint=models.UniqueConstraint(fields=('author', 'user'), name='unique_following'),
        ),
    ]
예제 #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')),
                ('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')),
                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ('password', models.CharField(default=None, max_length=128, 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')),
            ],
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.AddConstraint(
            model_name='user',
            constraint=models.UniqueConstraint(fields=('email',), name='EmailUnique'),
        ),
        migrations.AddConstraint(
            model_name='user',
            constraint=models.UniqueConstraint(fields=('username',), name='UsernameUnique'),
        ),
    ]
예제 #3
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            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=30, 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')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 10 characters or fewer.', max_length=10, primary_key=True, serialize=False, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator(), django.core.validators.MinLengthValidator(3)], verbose_name='username')),
                ('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='Group',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('course_code', models.CharField(max_length=30)),
                ('section', models.IntegerField()),
                ('name', models.CharField(max_length=128)),
                ('upload', models.BooleanField()),
                ('instructor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_instructor', to=settings.AUTH_USER_MODEL)),
                ('members', models.ManyToManyField(related_name='group_members', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddConstraint(
            model_name='group',
            constraint=models.UniqueConstraint(fields=('course_code', 'section', 'name'), name='unique_group'),
        ),
    ]
예제 #4
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='User',
            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')),
            ],
            options={
                'db_table': 'user',
            },
            bases=('auth.user',),
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Follow',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('from_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='following', to='user.user')),
                ('to_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='follower', to='user.user')),
            ],
            options={
                'db_table': 'follow',
            },
        ),
        migrations.AddConstraint(
            model_name='follow',
            constraint=models.UniqueConstraint(fields=('from_user', 'to_user'), name='unique follow'),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('core', '0007_auto_20210201_1115'),
    ]

    operations = [
        migrations.AlterModelManagers(
            name='habit',
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.RemoveConstraint(
            model_name='record',
            name='unique_habit',
        ),
        migrations.AddConstraint(
            model_name='record',
            constraint=models.UniqueConstraint(fields=('habit', 'date'),
                                               name='unique_record'),
        ),
    ]
예제 #6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('cm', '0083_add_product_category'),
        ('auth', '0012_alter_user_first_name_max_length'),
        ('guardian', '0002_generic_permissions_index'),
    ]

    operations = [
        migrations.CreateModel(
            name='Group',
            fields=[
                (
                    'group_ptr',
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to='auth.group',
                    ),
                ),
                ('description', models.CharField(max_length=255, null=True)),
                ('built_in', models.BooleanField(default=False)),
            ],
            bases=('auth.group',),
            managers=[
                ('objects', django.contrib.auth.models.GroupManager()),
            ],
        ),
        migrations.CreateModel(
            name='RoleMigration',
            fields=[
                ('version', models.PositiveIntegerField(primary_key=True, serialize=False)),
                ('date', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='User',
            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',
                    ),
                ),
                ('profile', models.JSONField(default=str)),
                ('built_in', models.BooleanField(default=False)),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            bases=('auth.user',),
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.RunPython(upgrade_users),
        migrations.RunPython(update_status_user),
        migrations.CreateModel(
            name='Role',
            fields=[
                (
                    'id',
                    models.AutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name='ID'
                    ),
                ),
                ('name', models.CharField(max_length=160)),
                ('description', models.TextField(blank=True)),
                ('display_name', models.CharField(default='', max_length=160)),
                ('module_name', models.CharField(max_length=32)),
                ('class_name', models.CharField(max_length=32)),
                ('init_params', models.JSONField(default=dict)),
                ('built_in', models.BooleanField(default=True)),
                (
                    'type',
                    models.CharField(
                        choices=[('business', 'business'), ('role', 'role'), ('hidden', 'hidden')],
                        default='role',
                        max_length=32,
                    ),
                ),
                ('any_category', models.BooleanField(default=False)),
                (
                    'parametrized_by_type',
                    models.JSONField(default=list, validators=[rbac.models.validate_object_type]),
                ),
                (
                    'bundle',
                    models.ForeignKey(
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to='cm.bundle',
                    ),
                ),
                ('category', models.ManyToManyField(to='cm.ProductCategory')),
                ('child', models.ManyToManyField(blank=True, to='rbac.Role')),
                ('permissions', models.ManyToManyField(blank=True, to='auth.Permission')),
            ],
        ),
        migrations.CreateModel(
            name='PolicyPermission',
            fields=[
                (
                    'id',
                    models.AutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name='ID'
                    ),
                ),
                (
                    'group',
                    models.ForeignKey(
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to='rbac.group',
                    ),
                ),
                (
                    'permission',
                    models.ForeignKey(
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to='auth.permission',
                    ),
                ),
                (
                    'user',
                    models.ForeignKey(
                        default=None,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to='rbac.user',
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name='PolicyObject',
            fields=[
                (
                    'id',
                    models.AutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name='ID'
                    ),
                ),
                ('object_id', models.PositiveIntegerField()),
                (
                    'content_type',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype'
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name='Policy',
            fields=[
                (
                    'id',
                    models.AutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name='ID'
                    ),
                ),
                ('name', models.CharField(max_length=255, unique=True)),
                ('description', models.TextField(blank=True)),
                ('built_in', models.BooleanField(default=True)),
                ('group', models.ManyToManyField(blank=True, to='rbac.Group')),
                (
                    'group_object_perm',
                    models.ManyToManyField(blank=True, to='guardian.GroupObjectPermission'),
                ),
                ('model_perm', models.ManyToManyField(blank=True, to='rbac.PolicyPermission')),
                ('object', models.ManyToManyField(blank=True, to='rbac.PolicyObject')),
                (
                    'role',
                    models.ForeignKey(
                        null=True, on_delete=django.db.models.deletion.SET_NULL, to='rbac.role'
                    ),
                ),
                ('user', models.ManyToManyField(blank=True, to='rbac.User')),
                (
                    'user_object_perm',
                    models.ManyToManyField(blank=True, to='guardian.UserObjectPermission'),
                ),
            ],
        ),
        migrations.AddIndex(
            model_name='role',
            index=models.Index(fields=['name', 'display_name'], name='rbac_role_name_b010fa_idx'),
        ),
        migrations.RunSQL(
            '''
            CREATE INDEX auth_user_name_b010fa_idx
            ON auth_user (username, first_name, last_name, email);
        '''
        ),
        migrations.RunSQL(
            '''
            CREATE INDEX auth_group_name_b010fa_idx
            ON auth_group (name);
        '''
        ),
        migrations.AddConstraint(
            model_name='role',
            constraint=models.UniqueConstraint(fields=('name', 'built_in'), name='unique_name'),
        ),
        migrations.AddConstraint(
            model_name='role',
            constraint=models.UniqueConstraint(
                fields=('display_name', 'built_in'), name='unique_display_name'
            ),
        ),
        migrations.AddConstraint(
            model_name='policyobject',
            constraint=models.UniqueConstraint(
                fields=('content_type', 'object_id'), name='unique_policy_object'
            ),
        ),
    ]
예제 #7
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('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')),
                ('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')),
                ('dob', models.DateField(blank=True, null=True)),
                ('gender', models.CharField(choices=[('m', 'male'), ('f', 'female')], max_length=1)),
                ('registerDate', models.DateField(auto_now_add=True)),
                ('avatar', models.TextField(default='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAM1BMVEXk5ueutLfn6eqrsbTp6+zg4uOwtrnJzc/j5earsbW0uby4vcDQ09XGyszU19jd3+G/xMamCvwDAAAFLklEQVR4nO2d2bLbIAxAbYE3sDH//7WFbPfexG4MiCAcnWmnrzkjIRaD2jQMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMw5wQkHJczewxZh2lhNK/CBOQo1n0JIT74/H/qMV0Z7GU3aCcVPuEE1XDCtVLAhgtpme7H0s1N1U7QjO0L8F7llzGeh1hEG/8Lo7TUmmuSrOfns9xnGXpXxsONPpA/B6OqqstjC6Ax/0ujkNdYQQbKNi2k64qiiEZ+ohi35X+2YcZw/WujmslYewiAliVYrxgJYrdwUmwXsU+RdApUi83oNIE27YvrfB/ZPg8+BJETXnqh9CVzBbTQHgojgiCvtqU9thFJg/CKz3VIMKMEkIXxIWqIpIg2SkjYj+xC816mrJae2aiWGykxRNsW0UwiJghJDljYI5CD8GRiCtIsJxizYUPQ2pzItZy5pcisTRdk/a9m4amtNNfBuQkdVhSaYqfpNTSFGfb9GRIakrE2Pm+GFLaCQPqiu0OpWP+HMPQQcgQMiQprWXNmsVwIjQjYi/ZrhAqNTCgr2gu0Jnz85RSSjso0HkMFZ0YZjKkc26a/jlmh9JiDyDxi9oeorTYAzZkwwoMz19pzj9bnH/GP/+qbchjSGflneWYhtTuKdMOmNKZcJ5TjInQKcYXnESd/jQxy0ENpULTNGOGgxpap/oyw9pbUAqhfx2Dbkhovvfgz4iUzoM9+GlK6/Mh4q29hyC1mwro30hpVVLPF9wYQr71RazOeM5/cw81iBRD+A03aM9/C/obbrKjbYSpCmIVG3qT/Q8oeUo3Rz0IL7vI1tEbCB9pSiu8I/aV8x3Kg/BGWrWp4ZVs0nZfmAoEG4h/61yHYIJiFSl6Q0Vk6tTW1N8kYp8hdOkfHYYMXd2Qft+8CYwqYDSKvqIh+MCF8Wgca2u/cwdgeW3TtuVn6+1oBs3yLo5C2JpK6CvQzGpfUkz9UG/87gCsi5o2LIXolxN0FbwAsjOLEr+YJmXn7iR6N0BCt5p5cMxm7eAsfS+/CACQf4CTpKjzgkvr2cVarVTf96372yut7XLJ1sa7lv6VcfgYrWaxqr3Wlo1S6pvStr22sxOtTNPLzdY3nj20bPP+ejFdJYkLsjGLdtPBEbe/mr2bQKiXWJDroA+vtzc0p9aahuwqHMDYrQEXHEw9jwQl3drMpts9JBU1SdktPe5FBRdJQ6bwXBpa57ib2A8kukQDzMjh++Uo7Fo6Wd02Pkf4fknqoo4HtvAIjsqUcjx6DIPgWCaOML9rKI/oqD9/lgNrn+eF+p7j8tnzHBiR7+kdUGw/+V1Kzkc75mMy6U+FMaxjPibiM1U1uGM+puInHpmALZCgP4pt7i840MV8+0R1zPsRB6UTcqpizncYwZ89syDydfyWCwXB1l8/zRNGWbTG/GHKUm9AkxHMc/EGSk3z2+ArEhPEV5TUBLEvUGFcjEUH80J/jveTGOAJEljJbILWGQT3zRYiwuKsUXN1EEJAzBhRJFll7mBUG7KD8EqPkKekBREaL8hMDZLQSG6AQjtHPYmvTQnX0TtpC1SYCe2YdkkyLP3jj5BSbKiuR585eQhTgoje6yIb0Yb0C+mV6EYvebqw5SDy2WmubogZiF2AVxPC2FpDf8H2Q9QWo6IkjUxTWVEI3WY/wrCeSuqJ+eRWzXR/JXwgVjUMozbCOfoEZiSiKVGepqv5CJ8RyR4D7xBeamqa7z3BJ/z17JxuBPdv93d/a2Ki878MMAzDMAzDMAzDMAzDMF/KP09VUmxBAiI3AAAAAElFTkSuQmCC')),
                ('country', models.CharField(blank=True, max_length=30, null=True)),
                ('email', models.EmailField(max_length=254, unique=True)),
                ('password', models.CharField(max_length=1024)),
                ('phone', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None)),
                ('membershipStartDate', models.DateField(blank=True, null=True)),
                ('isVerified', models.BooleanField(default=False)),
                ('isPaid', models.BooleanField(default=False)),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Actor',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=70, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=70, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Genre',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=70, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Membership',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=70)),
                ('duration', models.IntegerField()),
                ('price', models.FloatField()),
            ],
        ),
        migrations.CreateModel(
            name='Prize',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=70, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Producer',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=70, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Show',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=70)),
                ('productionDate', models.DateField()),
                ('rate', models.FloatField(default=3, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)])),
                ('parentGuide', models.CharField(choices=[('a', 'adults'), ('c', 'childern')], max_length=1)),
                ('videoURL', models.URLField(max_length=2048)),
                ('posterURL', models.URLField(max_length=2048)),
                ('description', models.TextField()),
                ('language', models.CharField(max_length=30)),
                ('country', models.CharField(max_length=30)),
                ('actors', models.ManyToManyField(to='netflixdb.Actor')),
                ('authors', models.ManyToManyField(to='netflixdb.Author')),
                ('genres', models.ManyToManyField(to='netflixdb.Genre')),
                ('prizes', models.ManyToManyField(blank=True, to='netflixdb.Prize')),
                ('producers', models.ManyToManyField(to='netflixdb.Producer')),
            ],
        ),
        migrations.CreateModel(
            name='UserReview',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('review', models.TextField()),
                ('rating', models.FloatField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)])),
                ('show', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='netflixdb.show')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ShowPlaylist',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('show', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='netflixdb.show')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ShowHistory',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('watchDate', models.DateTimeField(auto_now=True)),
                ('show', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='netflixdb.show')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='show',
            name='userReviews',
            field=models.ManyToManyField(blank=True, related_name='reviews', related_query_name='review', through='netflixdb.UserReview', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddConstraint(
            model_name='membership',
            constraint=models.UniqueConstraint(fields=('name', 'duration', 'price'), name='unique_membership'),
        ),
        migrations.AddField(
            model_name='user',
            name='currentShow',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='netflixdb.show'),
        ),
        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='membership',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='netflixdb.membership'),
        ),
        migrations.AddField(
            model_name='user',
            name='showsHistory',
            field=models.ManyToManyField(blank=True, related_name='viewers', related_query_name='viewer', through='netflixdb.ShowHistory', to='netflixdb.Show'),
        ),
        migrations.AddField(
            model_name='user',
            name='showsplaylist',
            field=models.ManyToManyField(blank=True, related_name='fans', related_query_name='fan', through='netflixdb.ShowPlaylist', to='netflixdb.Show'),
        ),
        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'),
        ),
        migrations.AddConstraint(
            model_name='userreview',
            constraint=models.UniqueConstraint(fields=('show', 'user'), name='unique_review'),
        ),
        migrations.AddConstraint(
            model_name='showplaylist',
            constraint=models.UniqueConstraint(fields=('user', 'show'), name='unique_showlist'),
        ),
        migrations.AddConstraint(
            model_name='showhistory',
            constraint=models.UniqueConstraint(fields=('user', 'show'), name='unique_showhistory'),
        ),
    ]
예제 #8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    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=30, 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')),
                ('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')),
            ],
            options={
                'verbose_name': 'bruger',
                'verbose_name_plural': 'brugere',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='ActivityDetails',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, verbose_name='Navn')),
                ('activity_id', models.CharField(max_length=128, unique=True, verbose_name='aktivitets ID')),
                ('max_tolerance_in_percent', models.PositiveSmallIntegerField(verbose_name='max tolerance i procent')),
                ('max_tolerance_in_dkk', models.PositiveIntegerField(verbose_name='max tolerance i DKK')),
                ('main_activities', models.ManyToManyField(blank=True, related_name='supplementary_activities', to='core.ActivityDetails', verbose_name='tilladte hovedaktiviteter')),
            ],
            options={
                'verbose_name': 'aktivitetsdetalje',
                'verbose_name_plural': 'aktivitetsdetaljer',
            },
        ),
        migrations.CreateModel(
            name='ApprovalLevel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, verbose_name='navn')),
            ],
            options={
                'verbose_name': 'bevillingsniveau',
                'verbose_name_plural': 'bevillingsniveauer',
            },
        ),
        migrations.CreateModel(
            name='Case',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('revision', models.CharField(blank=True, editable=False, help_text='System field. Git repository tag:branch:commit.', max_length=75, null=True, verbose_name='Revision')),
                ('created', models.DateTimeField(blank=True, default=django.utils.timezone.now)),
                ('modified', models.DateTimeField(blank=True, default=django.utils.timezone.now)),
                ('user_created', models.CharField(blank=True, help_text='Updated by admin.save_model', max_length=50, verbose_name='user created')),
                ('user_modified', models.CharField(blank=True, help_text='Updated by admin.save_model', max_length=50, verbose_name='user modified')),
                ('hostname_created', models.CharField(blank=True, default=_socket.gethostname, help_text='System field. (modified on create only)', max_length=60)),
                ('hostname_modified', models.CharField(blank=True, help_text='System field. (modified on every save)', max_length=50)),
                ('device_created', models.CharField(blank=True, max_length=10)),
                ('device_modified', models.CharField(blank=True, max_length=10)),
                ('sbsys_id', models.CharField(max_length=128, unique=True, verbose_name='SBSYS-ID')),
                ('cpr_number', models.CharField(max_length=10, verbose_name='cpr-nummer')),
                ('name', models.CharField(max_length=128, verbose_name='navn')),
                ('target_group', models.CharField(choices=[('FAMILY_DEPT', 'familieafdelingen'), ('DISABILITY_DEPT', 'handicapafdelingen')], max_length=128, verbose_name='målgruppe')),
                ('effort_step', models.PositiveSmallIntegerField(choices=[(1, 'Trin 1: Tidlig indsats i almenområdet'), (2, 'Trin 2: Forebyggelse'), (3, 'Trin 3: Hjemmebaserede indsatser'), (4, 'Trin 4: Anbringelse i slægt eller netværk'), (5, 'Trin 5: Anbringelse i forskellige typer af plejefamilier'), (6, 'Trin 6: Anbringelse i institutionstilbud')], verbose_name='indsatstrappe')),
                ('scaling_step', models.PositiveSmallIntegerField(choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10)], verbose_name='skaleringstrappe')),
                ('assessment_comment', models.TextField(blank=True, verbose_name='supplerende oplysninger til vurdering')),
                ('refugee_integration', models.BooleanField(default=False, verbose_name='integrationsindsatsen')),
                ('cross_department_measure', models.BooleanField(default=False, verbose_name='tværgående ungeindsats')),
                ('note', models.TextField(blank=True, verbose_name='note')),
            ],
            options={
                'verbose_name': 'sag',
                'verbose_name_plural': 'sager',
            },
        ),
        migrations.CreateModel(
            name='Municipality',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, verbose_name='navn')),
            ],
            options={
                'verbose_name': 'kommune',
                'verbose_name_plural': 'kommuner',
            },
        ),
        migrations.CreateModel(
            name='PaymentMethodDetails',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tax_card', models.CharField(choices=[('MAIN_CARD', 'Hovedkort'), ('SECONDARY_CARD', 'Bikort')], max_length=128, verbose_name='skattekort')),
            ],
            options={
                'verbose_name': 'betalingsmåde detalje',
                'verbose_name_plural': 'betalingsmåde detaljer',
            },
        ),
        migrations.CreateModel(
            name='SchoolDistrict',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, verbose_name='navn')),
            ],
            options={
                'verbose_name': 'distrikt',
                'verbose_name_plural': 'distrikter',
            },
        ),
        migrations.CreateModel(
            name='Section',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('paragraph', models.CharField(max_length=128, verbose_name='paragraf')),
                ('text', models.TextField(verbose_name='forklarende tekst')),
                ('allowed_for_family_target_group', models.BooleanField(default=False, verbose_name='tilladt for familieafdelingen')),
                ('allowed_for_disability_target_group', models.BooleanField(default=False, verbose_name='tilladt for handicapafdelingen')),
                ('allowed_for_steps', django.contrib.postgres.fields.ArrayField(base_field=models.PositiveSmallIntegerField(choices=[(1, 'Trin 1: Tidlig indsats i almenområdet'), (2, 'Trin 2: Forebyggelse'), (3, 'Trin 3: Hjemmebaserede indsatser'), (4, 'Trin 4: Anbringelse i slægt eller netværk'), (5, 'Trin 5: Anbringelse i forskellige typer af plejefamilier'), (6, 'Trin 6: Anbringelse i institutionstilbud')]), size=6, verbose_name='tilladt for trin i indsatstrappen')),
                ('law_text_name', models.CharField(max_length=128, verbose_name='lov tekst navn')),
            ],
            options={
                'verbose_name': 'paragraf',
                'verbose_name_plural': 'paragraffer',
            },
        ),
        migrations.CreateModel(
            name='ServiceProvider',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cvr_number', models.CharField(blank=True, max_length=8, verbose_name='cvr-nummer')),
                ('name', models.CharField(max_length=128, verbose_name='navn')),
                ('vat_factor', models.DecimalField(decimal_places=2, default=100.0, max_digits=5, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))], verbose_name='momsfaktor')),
            ],
            options={
                'verbose_name': 'leverandør',
                'verbose_name_plural': 'leverandører',
            },
        ),
        migrations.CreateModel(
            name='Team',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=128, verbose_name='navn')),
                ('leader', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='managed_teams', to=settings.AUTH_USER_MODEL, verbose_name='leder')),
            ],
        ),
        migrations.CreateModel(
            name='SectionInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('kle_number', models.CharField(blank=True, max_length=128, verbose_name='KLE-nummer')),
                ('sbsys_template_id', models.CharField(blank=True, max_length=128, verbose_name='SBSYS skabelon-id')),
                ('activity_details', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.ActivityDetails')),
                ('section', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Section')),
            ],
            options={
                'verbose_name': 'paragraf-info',
                'verbose_name_plural': 'paragraf-info',
            },
        ),
        migrations.CreateModel(
            name='RelatedPerson',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('relation_type', models.CharField(max_length=128, verbose_name='relation')),
                ('cpr_number', models.CharField(blank=True, max_length=10, verbose_name='cpr-nummer')),
                ('name', models.CharField(max_length=128, verbose_name='navn')),
                ('related_case', models.CharField(blank=True, max_length=128, verbose_name='SBSYS-sag')),
                ('main_case', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='related_persons', to='core.Case', verbose_name='hovedsag')),
            ],
            options={
                'verbose_name': 'relateret person',
                'verbose_name_plural': 'relaterede personer',
            },
        ),
        migrations.CreateModel(
            name='PaymentSchedule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('recipient_type', models.CharField(choices=[('INTERNAL', 'Intern'), ('PERSON', 'Person'), ('COMPANY', 'Firma')], max_length=128, verbose_name='betalingsmodtager')),
                ('recipient_id', models.CharField(max_length=128, verbose_name='ID')),
                ('recipient_name', models.CharField(max_length=128, verbose_name='navn')),
                ('payment_method', models.CharField(choices=[('CASH', 'Udbetaling'), ('SD', 'SD-LØN'), ('INVOICE', 'Faktura'), ('INTERNAL', 'Intern afregning')], max_length=128, verbose_name='betalingsmåde')),
                ('payment_frequency', models.CharField(blank=True, choices=[('DAILY', 'Dagligt'), ('WEEKLY', 'Ugentligt'), ('BIWEEKLY', 'Hver 2. uge'), ('MONTHLY', 'Månedligt')], max_length=128, null=True, verbose_name='betalingsfrekvens')),
                ('payment_day_of_month', models.IntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(31)], verbose_name='betales d.')),
                ('payment_type', models.CharField(choices=[('ONE_TIME_PAYMENT', 'Engangsudgift'), ('RUNNING_PAYMENT', 'Fast beløb, løbende'), ('PER_HOUR_PAYMENT', 'Takst pr. time'), ('PER_DAY_PAYMENT', 'Takst pr. døgn'), ('PER_KM_PAYMENT', 'Takst pr. kilometer')], max_length=128, verbose_name='betalingstype')),
                ('payment_units', models.DecimalField(blank=True, decimal_places=2, max_digits=14, null=True, validators=[django.core.validators.MinValueValidator(Decimal('0.00'))], verbose_name='betalingsenheder')),
                ('payment_amount', models.DecimalField(decimal_places=2, max_digits=14, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))], verbose_name='beløb')),
                ('payment_id', models.UUIDField(default=uuid.uuid4, editable=False)),
                ('payment_method_details', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.PaymentMethodDetails', verbose_name='betalingsmåde detalje')),
            ],
            options={
                'verbose_name': 'betalingsplan',
                'verbose_name_plural': 'betalingsplaner',
            },
        ),
        migrations.CreateModel(
            name='Payment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date', models.DateField(verbose_name='betalingsdato')),
                ('recipient_type', models.CharField(choices=[('INTERNAL', 'Intern'), ('PERSON', 'Person'), ('COMPANY', 'Firma')], max_length=128, verbose_name='betalingsmodtager')),
                ('recipient_id', models.CharField(max_length=128, verbose_name='ID')),
                ('recipient_name', models.CharField(max_length=128, verbose_name='Navn')),
                ('payment_method', models.CharField(choices=[('CASH', 'Udbetaling'), ('SD', 'SD-LØN'), ('INVOICE', 'Faktura'), ('INTERNAL', 'Intern afregning')], max_length=128, verbose_name='betalingsmåde')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=14, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))], verbose_name='beløb')),
                ('paid', models.BooleanField(default=False, verbose_name='betalt')),
                ('payment_schedule', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payments', to='core.PaymentSchedule', verbose_name='betalingsplan')),
            ],
            options={
                'verbose_name': 'betaling',
                'verbose_name_plural': 'betalinger',
            },
        ),
        migrations.CreateModel(
            name='HistoricalCase',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('revision', models.CharField(blank=True, editable=False, help_text='System field. Git repository tag:branch:commit.', max_length=75, null=True, verbose_name='Revision')),
                ('created', models.DateTimeField(blank=True, default=django.utils.timezone.now)),
                ('modified', models.DateTimeField(blank=True, default=django.utils.timezone.now)),
                ('user_created', models.CharField(blank=True, help_text='Updated by admin.save_model', max_length=50, verbose_name='user created')),
                ('user_modified', models.CharField(blank=True, help_text='Updated by admin.save_model', max_length=50, verbose_name='user modified')),
                ('hostname_created', models.CharField(blank=True, default=_socket.gethostname, help_text='System field. (modified on create only)', max_length=60)),
                ('hostname_modified', models.CharField(blank=True, help_text='System field. (modified on every save)', max_length=50)),
                ('device_created', models.CharField(blank=True, max_length=10)),
                ('device_modified', models.CharField(blank=True, max_length=10)),
                ('effort_step', models.PositiveSmallIntegerField(choices=[(1, 'Trin 1: Tidlig indsats i almenområdet'), (2, 'Trin 2: Forebyggelse'), (3, 'Trin 3: Hjemmebaserede indsatser'), (4, 'Trin 4: Anbringelse i slægt eller netværk'), (5, 'Trin 5: Anbringelse i forskellige typer af plejefamilier'), (6, 'Trin 6: Anbringelse i institutionstilbud')], verbose_name='indsatstrappe')),
                ('scaling_step', models.PositiveSmallIntegerField(choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10)], verbose_name='skaleringstrappe')),
                ('assessment_comment', models.TextField(blank=True, verbose_name='supplerende oplysninger til vurdering')),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('case_worker', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='sagsbehandler')),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('team', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='core.Team', verbose_name='team')),
            ],
            options={
                'verbose_name': 'historical sag',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.AddField(
            model_name='case',
            name='acting_municipality',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='acts_on', to='core.Municipality', verbose_name='handlekommune'),
        ),
        migrations.AddField(
            model_name='case',
            name='case_worker',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='cases', to=settings.AUTH_USER_MODEL, verbose_name='sagsbehandler'),
        ),
        migrations.AddField(
            model_name='case',
            name='district',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='cases', to='core.SchoolDistrict', verbose_name='skoledistrikt'),
        ),
        migrations.AddField(
            model_name='case',
            name='paying_municipality',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='pays_for', to='core.Municipality', verbose_name='betalingskommune'),
        ),
        migrations.AddField(
            model_name='case',
            name='residence_municipality',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='resident_clients', to='core.Municipality', verbose_name='bopælskommune'),
        ),
        migrations.AddField(
            model_name='case',
            name='team',
            field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.PROTECT, related_name='cases', to='core.Team', verbose_name='team'),
        ),
        migrations.CreateModel(
            name='Appropriation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('revision', models.CharField(blank=True, editable=False, help_text='System field. Git repository tag:branch:commit.', max_length=75, null=True, verbose_name='Revision')),
                ('created', models.DateTimeField(blank=True, default=django.utils.timezone.now)),
                ('modified', models.DateTimeField(blank=True, default=django.utils.timezone.now)),
                ('user_created', models.CharField(blank=True, help_text='Updated by admin.save_model', max_length=50, verbose_name='user created')),
                ('user_modified', models.CharField(blank=True, help_text='Updated by admin.save_model', max_length=50, verbose_name='user modified')),
                ('hostname_created', models.CharField(blank=True, default=_socket.gethostname, help_text='System field. (modified on create only)', max_length=60)),
                ('hostname_modified', models.CharField(blank=True, help_text='System field. (modified on every save)', max_length=50)),
                ('device_created', models.CharField(blank=True, max_length=10)),
                ('device_modified', models.CharField(blank=True, max_length=10)),
                ('sbsys_id', models.CharField(max_length=128, unique=True, verbose_name='SBSYS-ID')),
                ('note', models.TextField(blank=True, verbose_name='supplerende oplysninger')),
                ('case', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='appropriations', to='core.Case', verbose_name='sag')),
                ('section', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='appropriations', to='core.Section', verbose_name='paragraf')),
            ],
            options={
                'verbose_name': 'bevilling',
                'verbose_name_plural': 'bevillinger',
            },
        ),
        migrations.AddField(
            model_name='activitydetails',
            name='main_activity_for',
            field=models.ManyToManyField(blank=True, related_name='main_activities', through='core.SectionInfo', to='core.Section', verbose_name='hovedaktivitet for paragraffer'),
        ),
        migrations.AddField(
            model_name='activitydetails',
            name='service_providers',
            field=models.ManyToManyField(blank=True, related_name='supplied_activities', to='core.ServiceProvider', verbose_name='leverandører'),
        ),
        migrations.AddField(
            model_name='activitydetails',
            name='supplementary_activity_for',
            field=models.ManyToManyField(blank=True, related_name='supplementary_activities', to='core.Section', verbose_name='følgeudgift for paragraffer'),
        ),
        migrations.CreateModel(
            name='Activity',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('revision', models.CharField(blank=True, editable=False, help_text='System field. Git repository tag:branch:commit.', max_length=75, null=True, verbose_name='Revision')),
                ('created', models.DateTimeField(blank=True, default=django.utils.timezone.now)),
                ('modified', models.DateTimeField(blank=True, default=django.utils.timezone.now)),
                ('user_created', models.CharField(blank=True, help_text='Updated by admin.save_model', max_length=50, verbose_name='user created')),
                ('user_modified', models.CharField(blank=True, help_text='Updated by admin.save_model', max_length=50, verbose_name='user modified')),
                ('hostname_created', models.CharField(blank=True, default=_socket.gethostname, help_text='System field. (modified on create only)', max_length=60)),
                ('hostname_modified', models.CharField(blank=True, help_text='System field. (modified on every save)', max_length=50)),
                ('device_created', models.CharField(blank=True, max_length=10)),
                ('device_modified', models.CharField(blank=True, max_length=10)),
                ('status', models.CharField(choices=[('DRAFT', 'kladde'), ('EXPECTED', 'forventet'), ('GRANTED', 'bevilget')], max_length=128, verbose_name='status')),
                ('approval_note', models.TextField(blank=True, verbose_name='evt. bemærkning')),
                ('appropriation_date', models.DateField(blank=True, null=True, verbose_name='bevillingsdato')),
                ('start_date', models.DateField(verbose_name='startdato')),
                ('end_date', models.DateField(blank=True, null=True, verbose_name='slutdato')),
                ('activity_type', models.CharField(choices=[('MAIN_ACTIVITY', 'hovedaktivitet'), ('SUPPL_ACTIVITY', 'følgeaktivitet')], max_length=128, verbose_name='type')),
                ('note', models.TextField(blank=True, max_length=1000, null=True)),
                ('appropriation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='core.Appropriation', verbose_name='bevilling')),
                ('approval_level', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_activities', to='core.ApprovalLevel', verbose_name='bevillingsniveau')),
                ('approval_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='approved_activities', to=settings.AUTH_USER_MODEL, verbose_name='bevilget af bruger')),
                ('details', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='core.ActivityDetails', verbose_name='aktivitetsdetalje')),
                ('modifies', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='modified_by', to='core.Activity')),
                ('payment_plan', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='core.PaymentSchedule', verbose_name='betalingsplan')),
                ('service_provider', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='activities', to='core.ServiceProvider', verbose_name='leverandør')),
            ],
            options={
                'verbose_name': 'aktivitet',
                'verbose_name_plural': 'aktiviteter',
            },
        ),
        migrations.CreateModel(
            name='Account',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.CharField(max_length=128, verbose_name='konteringsnummer')),
                ('main_activity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='main_accounts', to='core.ActivityDetails', verbose_name='hovedaktivitet')),
                ('section', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='accounts', to='core.Section', verbose_name='paragraf')),
                ('supplementary_activity', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='supplementary_accounts', to='core.ActivityDetails', verbose_name='følgeudgift')),
            ],
            options={
                'verbose_name': 'konto',
                'verbose_name_plural': 'konti',
            },
        ),
        migrations.AddField(
            model_name='user',
            name='team',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='users', to='core.Team'),
        ),
        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'),
        ),
        migrations.AddConstraint(
            model_name='activity',
            constraint=models.CheckConstraint(check=models.Q(start_date__lte=django.db.models.expressions.F('end_date')), name='end_date_after_start_date'),
        ),
        migrations.AddConstraint(
            model_name='activity',
            constraint=models.UniqueConstraint(condition=models.Q(('activity_type', 'MAIN_ACTIVITY'), ('modifies__isnull', True)), fields=('appropriation',), name='unique_main_activity'),
        ),
        migrations.AddConstraint(
            model_name='account',
            constraint=models.UniqueConstraint(fields=('main_activity', 'supplementary_activity', 'section'), name='unique_account_number'),
        ),
    ]
예제 #9
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserProfile',
            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=30, 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')),
                ('bio', models.TextField(blank=True, max_length=500)),
                ('image', models.ImageField(blank=True, null=True, upload_to='images/users')),
                ('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='VisibilityMixin',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('visibility', models.CharField(choices=[('pr', 'Private'), ('li', 'Access with link'), ('pu', 'Public')], default='pr', max_length=2)),
            ],
        ),
        migrations.CreateModel(
            name='Collection',
            fields=[
                ('visibilitymixin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='editor.VisibilityMixin')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ('title', models.CharField(max_length=200)),
                ('description', models.TextField(blank=True)),
                ('image', models.ImageField(blank=True, null=True, upload_to='images/collections')),
            ],
            options={
                'abstract': False,
            },
            bases=('editor.visibilitymixin', models.Model),
        ),
        migrations.CreateModel(
            name='Document',
            fields=[
                ('visibilitymixin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='editor.VisibilityMixin')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
                ('title', models.CharField(max_length=200)),
                ('content', models.TextField(blank=True)),
                ('forked_from', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='editor.Document')),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
            bases=('editor.visibilitymixin', models.Model),
        ),
        migrations.CreateModel(
            name='DocumentStar',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('document', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='editor.Document')),
            ],
        ),
        migrations.AddField(
            model_name='document',
            name='stars',
            field=models.ManyToManyField(related_name='starred_documents', through='editor.DocumentStar', to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='CollectionStar',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='editor.Collection')),
            ],
        ),
        migrations.AddField(
            model_name='collection',
            name='documents',
            field=models.ManyToManyField(blank=True, to='editor.Document'),
        ),
        migrations.AddField(
            model_name='collection',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='collection',
            name='stars',
            field=models.ManyToManyField(related_name='starred_collections', through='editor.CollectionStar', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddConstraint(
            model_name='documentstar',
            constraint=models.UniqueConstraint(fields=('user', 'document'), name='document_unique_key'),
        ),
        migrations.AddConstraint(
            model_name='collectionstar',
            constraint=models.UniqueConstraint(fields=('user', 'collection'), name='collection_unique_key'),
        ),
    ]
예제 #10
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name="User",
            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",
                    ),
                ),
                (
                    "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")),
                (
                    "id",
                    models.UUIDField(
                        db_index=True,
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                ("created_at",
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      verbose_name="Created At")),
                ("updated_at",
                 models.DateTimeField(auto_now=True,
                                      db_index=True,
                                      verbose_name="Updated At")),
                (
                    "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",
            },
            bases=(django_lifecycle.mixins.LifecycleModelMixin, models.Model),
            managers=[
                ("objects", django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name="Entry",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        db_index=True,
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                ("created_at",
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      verbose_name="Created At")),
                ("updated_at",
                 models.DateTimeField(auto_now=True,
                                      db_index=True,
                                      verbose_name="Updated At")),
                ("content", models.TextField(max_length=1000)),
                (
                    "author",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="entries",
                        to=settings.AUTH_USER_MODEL),
                ),
            ],
            options={
                "verbose_name": "Entry",
                "verbose_name_plural": "Entries",
            },
            bases=(django_lifecycle.mixins.LifecycleModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name="Topic",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        db_index=True,
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                ("created_at",
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      verbose_name="Created At")),
                ("updated_at",
                 models.DateTimeField(auto_now=True,
                                      db_index=True,
                                      verbose_name="Updated At")),
                ("name", models.CharField(max_length=50)),
            ],
            options={
                "verbose_name": "Topic",
                "verbose_name_plural": "Topics",
            },
            bases=(django_lifecycle.mixins.LifecycleModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name="Vote",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        db_index=True,
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                ("created_at",
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      verbose_name="Created At")),
                ("updated_at",
                 models.DateTimeField(auto_now=True,
                                      db_index=True,
                                      verbose_name="Updated At")),
                ("type",
                 models.CharField(choices=[("upvote", "upvote"),
                                           ("downvote", "downvote")],
                                  max_length=10)),
                ("by",
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ("to",
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to="core.entry")),
            ],
            options={
                "verbose_name": "Vote",
                "verbose_name_plural": "Votes",
            },
            bases=(django_lifecycle.mixins.LifecycleModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name="Title",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        db_index=True,
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                ("created_at",
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      verbose_name="Created At")),
                ("updated_at",
                 models.DateTimeField(auto_now=True,
                                      db_index=True,
                                      verbose_name="Updated At")),
                ("name", models.CharField(max_length=100)),
                (
                    "topic",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="titles",
                        to="core.topic"),
                ),
            ],
            options={
                "verbose_name": "Title",
                "verbose_name_plural": "Titles",
            },
            bases=(django_lifecycle.mixins.LifecycleModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name="Subscription",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        db_index=True,
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                ("created_at",
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      verbose_name="Created At")),
                ("updated_at",
                 models.DateTimeField(auto_now=True,
                                      db_index=True,
                                      verbose_name="Updated At")),
                ("by",
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ("to",
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to="core.title")),
            ],
            options={
                "verbose_name": "Subscription",
                "verbose_name_plural": "Subscriptions",
            },
            bases=(django_lifecycle.mixins.LifecycleModelMixin, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalVote",
            fields=[
                ("id",
                 models.UUIDField(db_index=True,
                                  default=uuid.uuid4,
                                  editable=False,
                                  verbose_name="ID")),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                (
                    "created_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Created At"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Updated At"),
                ),
                ("type",
                 models.CharField(choices=[("upvote", "upvote"),
                                           ("downvote", "downvote")],
                                  max_length=10)),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(choices=[("+", "Created"),
                                              ("~", "Changed"),
                                              ("-", "Deleted")],
                                     max_length=1),
                ),
                (
                    "by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "to",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="core.entry",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Vote",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalUser",
            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",
                    ),
                ),
                (
                    "username",
                    models.CharField(
                        db_index=True,
                        error_messages={
                            "unique":
                            "A user with that username already exists."
                        },
                        help_text=
                        "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
                        max_length=150,
                        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")),
                ("id",
                 models.UUIDField(db_index=True,
                                  default=uuid.uuid4,
                                  editable=False,
                                  verbose_name="ID")),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                (
                    "created_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Created At"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Updated At"),
                ),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(choices=[("+", "Created"),
                                              ("~", "Changed"),
                                              ("-", "Deleted")],
                                     max_length=1),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical User",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalTopic",
            fields=[
                ("id",
                 models.UUIDField(db_index=True,
                                  default=uuid.uuid4,
                                  editable=False,
                                  verbose_name="ID")),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                (
                    "created_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Created At"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Updated At"),
                ),
                ("name", models.CharField(max_length=50)),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(choices=[("+", "Created"),
                                              ("~", "Changed"),
                                              ("-", "Deleted")],
                                     max_length=1),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Topic",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalTitle",
            fields=[
                ("id",
                 models.UUIDField(db_index=True,
                                  default=uuid.uuid4,
                                  editable=False,
                                  verbose_name="ID")),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                (
                    "created_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Created At"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Updated At"),
                ),
                ("name", models.CharField(max_length=100)),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(choices=[("+", "Created"),
                                              ("~", "Changed"),
                                              ("-", "Deleted")],
                                     max_length=1),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "topic",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="core.topic",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Title",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalSubscription",
            fields=[
                ("id",
                 models.UUIDField(db_index=True,
                                  default=uuid.uuid4,
                                  editable=False,
                                  verbose_name="ID")),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                (
                    "created_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Created At"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Updated At"),
                ),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(choices=[("+", "Created"),
                                              ("~", "Changed"),
                                              ("-", "Deleted")],
                                     max_length=1),
                ),
                (
                    "by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "to",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="core.title",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Subscription",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalEntry",
            fields=[
                ("id",
                 models.UUIDField(db_index=True,
                                  default=uuid.uuid4,
                                  editable=False,
                                  verbose_name="ID")),
                ("slug",
                 models.SlugField(blank=True, null=True, verbose_name="Slug")),
                (
                    "created_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Created At"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         verbose_name="Updated At"),
                ),
                ("content", models.TextField(max_length=1000)),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(choices=[("+", "Created"),
                                              ("~", "Changed"),
                                              ("-", "Deleted")],
                                     max_length=1),
                ),
                (
                    "author",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "title",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="core.title",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Entry",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.AddField(
            model_name="entry",
            name="title",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="entries",
                to="core.title"),
        ),
        migrations.AddConstraint(
            model_name="vote",
            constraint=models.UniqueConstraint(fields=("by", "to"),
                                               name="unique_entry_vote"),
        ),
        migrations.AddConstraint(
            model_name="subscription",
            constraint=models.UniqueConstraint(fields=("by", "to"),
                                               name="unique_subscription"),
        ),
    ]
예제 #11
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    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=30,
                                  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')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('type',
                 models.CharField(choices=[('shop', 'Магазин'),
                                           ('buyer', 'Покупатель')],
                                  default='buyer',
                                  max_length=5,
                                  verbose_name='Тип пользователя')),
                ('company',
                 models.CharField(blank=True,
                                  max_length=40,
                                  verbose_name='Компания')),
                ('position',
                 models.CharField(blank=True,
                                  max_length=40,
                                  verbose_name='Должность')),
                ('is_active', models.BooleanField(default=False)),
                ('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': 'Пользователь',
                'verbose_name_plural': 'Пользователи',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Cart',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
            ],
            options={
                'verbose_name_plural': 'Корзина',
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=40, verbose_name='Название')),
            ],
            options={
                'verbose_name': 'Категория',
                'verbose_name_plural': 'Список категорий',
                'ordering': ('-name', ),
            },
        ),
        migrations.CreateModel(
            name='Contact',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('city', models.CharField(max_length=50,
                                          verbose_name='Город')),
                ('street',
                 models.CharField(max_length=100, verbose_name='Улица')),
                ('house',
                 models.CharField(blank=True,
                                  max_length=15,
                                  verbose_name='Дом')),
                ('structure',
                 models.CharField(blank=True,
                                  max_length=15,
                                  verbose_name='Корпус')),
                ('building',
                 models.CharField(blank=True,
                                  max_length=15,
                                  verbose_name='Строение')),
                ('apartment',
                 models.CharField(blank=True,
                                  max_length=15,
                                  verbose_name='Квартира')),
                ('phone',
                 models.CharField(max_length=20, verbose_name='Телефон')),
                ('user',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='contacts',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Пользователь')),
            ],
            options={
                'verbose_name': 'Контакты пользователя',
                'verbose_name_plural': 'Список контактов пользователя',
            },
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('external_id',
                 models.PositiveIntegerField(
                     null=True, verbose_name='Дополнительный ID')),
                ('dt', models.DateTimeField(auto_now_add=True)),
                ('state',
                 models.CharField(choices=[('new', 'Новый'),
                                           ('confirmed', 'Подтвержден'),
                                           ('assembled', 'Собран'),
                                           ('sent', 'Отправлен'),
                                           ('delivered', 'Доставлен'),
                                           ('canceled', 'Отменен')],
                                  default='new',
                                  max_length=15,
                                  verbose_name='Статус')),
                ('total_summ',
                 models.PositiveIntegerField(default=0, verbose_name='Cумма')),
                ('order_pdf',
                 models.FilePathField(blank=True,
                                      null=True,
                                      verbose_name='Заказ в PDF')),
                ('contact',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='backend.Contact',
                     verbose_name='Контакт')),
            ],
            options={
                'verbose_name': 'Заказ',
                'verbose_name_plural': 'Список заказ',
                'ordering': ('-dt', ),
            },
        ),
        migrations.CreateModel(
            name='Parameter',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=40, verbose_name='Название')),
            ],
            options={
                'verbose_name': 'Имя параметра',
                'verbose_name_plural': 'Список имен параметров',
                'ordering': ('-name', ),
            },
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=80, verbose_name='Название')),
                ('on_sale',
                 models.BooleanField(default=True, verbose_name='На продаже')),
                ('category',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='products',
                                   to='backend.Category',
                                   verbose_name='Категория')),
            ],
            options={
                'verbose_name': 'Продукт',
                'verbose_name_plural': 'Список продуктов',
                'ordering': ('-name', ),
            },
        ),
        migrations.CreateModel(
            name='ProductInfo',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('model',
                 models.CharField(blank=True,
                                  max_length=80,
                                  verbose_name='Модель')),
                ('external_id',
                 models.PositiveIntegerField(verbose_name='Внешний ИД')),
                ('quantity',
                 models.PositiveIntegerField(verbose_name='Количество')),
                ('price', models.PositiveIntegerField(verbose_name='Цена')),
                ('price_rrc',
                 models.PositiveIntegerField(
                     verbose_name='Рекомендуемая розничная цена')),
                ('product',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='product_infos',
                                   to='backend.Product',
                                   verbose_name='Продукт')),
            ],
            options={
                'verbose_name': 'Информация о продукте',
                'verbose_name_plural': 'Информационный список о продуктах',
            },
        ),
        migrations.CreateModel(
            name='Shop',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=50, verbose_name='Название')),
                ('url',
                 models.URLField(blank=True, null=True,
                                 verbose_name='Ссылка')),
                ('state',
                 models.BooleanField(default=True,
                                     verbose_name='статус получения заказов')),
                ('user',
                 models.OneToOneField(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL,
                     verbose_name='Пользователь')),
            ],
            options={
                'verbose_name': 'Магазин',
                'verbose_name_plural': 'Список магазинов',
                'ordering': ('-name', ),
            },
        ),
        migrations.CreateModel(
            name='ProductParameter',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('value',
                 models.CharField(max_length=100, verbose_name='Значение')),
                ('parameter',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='product_parameters',
                                   to='backend.Parameter',
                                   verbose_name='Параметр')),
                ('product_info',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='product_parameters',
                                   to='backend.ProductInfo',
                                   verbose_name='Информация о продукте')),
            ],
            options={
                'verbose_name': 'Параметр',
                'verbose_name_plural': 'Список параметров',
            },
        ),
        migrations.AddField(
            model_name='productinfo',
            name='shop',
            field=models.ForeignKey(
                blank=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='product_infos',
                to='backend.Shop',
                verbose_name='Магазин'),
        ),
        migrations.CreateModel(
            name='OrderItem',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('quantity',
                 models.PositiveIntegerField(verbose_name='Количество')),
                ('order',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='ordered_items',
                                   to='backend.Order',
                                   verbose_name='Заказ')),
                ('product_info',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='ordered_items',
                                   to='backend.ProductInfo',
                                   verbose_name='Информация о продукте')),
            ],
            options={
                'verbose_name': 'Заказанная позиция',
                'verbose_name_plural': 'Список заказанных позиций',
            },
        ),
        migrations.AddField(
            model_name='order',
            name='items',
            field=models.ManyToManyField(related_name='ordered_items',
                                         to='backend.OrderItem'),
        ),
        migrations.AddField(
            model_name='order',
            name='shop',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='backend.Shop',
                verbose_name='Магазин'),
        ),
        migrations.AddField(
            model_name='order',
            name='user',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name='orders',
                to=settings.AUTH_USER_MODEL,
                verbose_name='Пользователь'),
        ),
        migrations.CreateModel(
            name='ConformaionCode',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('code', models.CharField(max_length=100)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='category',
            name='shops',
            field=models.ManyToManyField(blank=True,
                                         related_name='categories',
                                         to='backend.Shop',
                                         verbose_name='Магазины'),
        ),
        migrations.CreateModel(
            name='CartItem',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('quantity',
                 models.IntegerField(default=0, verbose_name='Количество')),
                ('cart',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='cart_items',
                                   to='backend.Cart')),
                ('product_info',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='backend.ProductInfo',
                                   verbose_name='Товар')),
            ],
        ),
        migrations.AddField(
            model_name='cart',
            name='items',
            field=models.ManyToManyField(blank=True,
                                         related_name='cart_items',
                                         to='backend.CartItem'),
        ),
        migrations.AddField(
            model_name='cart',
            name='user',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to=settings.AUTH_USER_MODEL,
                verbose_name='Пользователь'),
        ),
        migrations.AddConstraint(
            model_name='productparameter',
            constraint=models.UniqueConstraint(
                fields=('product_info', 'parameter'),
                name='unique_product_parameter'),
        ),
        migrations.AddConstraint(
            model_name='productinfo',
            constraint=models.UniqueConstraint(fields=('product', 'shop',
                                                       'external_id'),
                                               name='unique_product_info'),
        ),
        migrations.AddConstraint(
            model_name='orderitem',
            constraint=models.UniqueConstraint(fields=('order_id',
                                                       'product_info'),
                                               name='unique_order_item'),
        ),
    ]
예제 #12
0
 class Meta(OrderedModel.Meta):
     constraints = [
         models.UniqueConstraint(fields=['user', 'language'], name='unique_user_language'),
     ]
예제 #13
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('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')),
                ('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')),
                ('first_name', models.CharField(max_length=255)),
                ('last_name', models.CharField(max_length=255)),
                ('password', models.CharField(max_length=255)),
                ('email', models.CharField(max_length=255, unique=True)),
                ('username',
                 models.CharField(default=True, max_length=255, unique=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={
                'abstract': False,
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Ingredient',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('ingredientName', models.CharField(max_length=255,
                                                    unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Recipe',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('recipeName', models.CharField(max_length=255)),
                ('recipeText', models.TextField(max_length=2000)),
                ('creator',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('ingredient',
                 models.ManyToManyField(to='recipes.Ingredient')),
            ],
        ),
        migrations.CreateModel(
            name='Rating',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('score', models.IntegerField()),
                ('recipe',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='recipes.Recipe')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddConstraint(
            model_name='recipe',
            constraint=models.UniqueConstraint(fields=('recipeName', 'creator',
                                                       'ingredient'),
                                               name='unique score'),
        ),
        migrations.AddConstraint(
            model_name='rating',
            constraint=models.UniqueConstraint(fields=('recipe', 'user'),
                                               name='unique score'),
        ),
    ]
예제 #14
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='MyUser',
            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=30,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='last name')),
                ('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')),
                ('email',
                 models.EmailField(help_text='Электронная почта пользователя',
                                   max_length=50,
                                   unique=True,
                                   verbose_name='Электронная почта')),
                ('bio',
                 models.CharField(blank=True,
                                  help_text='Информация о пользователе',
                                  max_length=255,
                                  verbose_name='Информация')),
                ('role',
                 models.CharField(choices=[('user', 'User'),
                                           ('moderator', 'Moderator'),
                                           ('admin', 'Admin')],
                                  default='user',
                                  help_text='Права пользователя',
                                  max_length=50,
                                  verbose_name='Права')),
                ('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': 'Пользователь',
                'verbose_name_plural': 'Пользователи',
                'ordering': ['email'],
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(
                     help_text='Максимальная длина, 200 символов.',
                     max_length=200,
                     verbose_name='Название')),
                ('slug',
                 models.SlugField(
                     help_text='Содержание уникальное, длиной до 10 символов.',
                     max_length=10,
                     unique=True,
                     verbose_name='Ссылка')),
            ],
            options={
                'verbose_name': 'Категория',
                'verbose_name_plural': 'Категории',
            },
        ),
        migrations.CreateModel(
            name='Genre',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(
                     help_text='Максимальная длина, 200 символов.',
                     max_length=200,
                     verbose_name='Название')),
                ('slug',
                 models.SlugField(
                     help_text='Содержание уникальное, длиной до 10 символов.',
                     max_length=10,
                     unique=True,
                     verbose_name='Ссылка')),
            ],
            options={
                'verbose_name': 'Жанр',
                'verbose_name_plural': 'Жанры',
            },
        ),
        migrations.CreateModel(
            name='Title',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(
                     help_text='Максимальная длина, 200 символов.',
                     max_length=200,
                     verbose_name='Название')),
                ('year',
                 models.PositiveSmallIntegerField(db_index=True,
                                                  verbose_name='Год')),
                ('description',
                 models.TextField(blank=True,
                                  help_text='Необязательное к заполнению.',
                                  verbose_name='Описание')),
                ('category',
                 models.ForeignKey(
                     blank=True,
                     help_text='Необязательное к заполнению.',
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='titles',
                     to='api.Category',
                     verbose_name='Категория')),
                ('genre',
                 models.ManyToManyField(
                     blank=True,
                     help_text='Необязательное к заполнению.',
                     related_name='titles',
                     to='api.Genre',
                     verbose_name='Жанр')),
            ],
            options={
                'verbose_name': 'Произведение',
                'verbose_name_plural': 'Произведения',
            },
        ),
        migrations.CreateModel(
            name='Review',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('text',
                 models.TextField(help_text='Отзыв пользователя',
                                  verbose_name='Отзыв')),
                ('score',
                 models.PositiveSmallIntegerField(
                     help_text='Оценка пользователя',
                     validators=[
                         django.core.validators.MinValueValidator(
                             1, 'Оценка не может быть меньше 1.'),
                         django.core.validators.MaxValueValidator(
                             10, 'Оценка не может быть больше 10.')
                     ],
                     verbose_name='Оценка')),
                ('pub_date',
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      help_text='Дата добавления отзыва',
                                      verbose_name='Дата добавления')),
                ('author',
                 models.ForeignKey(help_text='Автор отзыва',
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='reviews',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Автор отзыва')),
                ('title',
                 models.ForeignKey(
                     help_text='Произведение, на которое сделан отзыв',
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='reviews',
                     to='api.Title',
                     verbose_name='Произведение')),
            ],
            options={
                'verbose_name': 'Отзыв пользователя',
                'verbose_name_plural': 'Отзывы пользователей',
                'ordering': ['title'],
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('text',
                 models.TextField(help_text='Комментарий пользователя',
                                  verbose_name='Комментарий')),
                ('pub_date',
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      help_text='Дата добавления комментария',
                                      verbose_name='Дата добавления')),
                ('author',
                 models.ForeignKey(help_text='Автор комментария',
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Автор комментария')),
                ('review_id',
                 models.ForeignKey(help_text='Комментируемый отзыв',
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to='api.Review',
                                   verbose_name='Комментируемый отзыв')),
            ],
            options={
                'verbose_name': 'Комментарий пользователя',
                'verbose_name_plural': 'Комментарии пользователей',
                'ordering': ['-pub_date'],
            },
        ),
        migrations.AddConstraint(
            model_name='review',
            constraint=models.UniqueConstraint(fields=('author', 'title'),
                                               name='unique_review'),
        ),
    ]
예제 #15
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("auth", "0011_update_proxy_permissions"),
    ]

    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=30,
                                     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"),
                ),
                (
                    "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="Order",
            fields=[
                (
                    "transaction_id",
                    models.UUIDField(default=uuid.uuid4,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("transaction_time", models.DateTimeField()),
                ("is_gift", models.BooleanField()),
                ("shipping_date", models.DateField()),
                (
                    "additional_data",
                    django.contrib.postgres.fields.jsonb.JSONField(
                        default=dict),
                ),
                (
                    "buyer",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Product",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("ean", models.CharField(max_length=13, unique=True)),
                ("title", models.CharField(max_length=255)),
                ("description", models.TextField()),
                ("unit_price",
                 models.DecimalField(decimal_places=2, max_digits=8)),
                (
                    "materials",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=255),
                        size=None),
                ),
            ],
        ),
        migrations.CreateModel(
            name="OrderItem",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("quantity", models.PositiveIntegerField()),
                (
                    "order",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="tests.Order"),
                ),
                (
                    "product",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="tests.Product"),
                ),
            ],
        ),
        migrations.AddField(
            model_name="order",
            name="items",
            field=models.ManyToManyField(through="tests.OrderItem",
                                         to="tests.Product"),
        ),
        migrations.AddConstraint(
            model_name="orderitem",
            constraint=models.UniqueConstraint(fields=("order", "product"),
                                               name="order_product_unique"),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = [("auth", "0011_update_proxy_permissions")]

    operations = [
        migrations.CreateModel(
            name="CustomUser",
            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=30, 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"
                    ),
                ),
                ("date_of_birth", models.DateField(blank=True, null=True)),
                ("gender", models.CharField(blank=True, max_length=255)),
                ("bio", models.TextField(blank=True, default="", max_length=500)),
            ],
            options={
                "verbose_name": "user",
                "verbose_name_plural": "users",
                "abstract": False,
            },
            managers=[("objects", django.contrib.auth.models.UserManager())],
        ),
        migrations.CreateModel(
            name="Concert",
            fields=[
                ("id", models.IntegerField(primary_key=True, serialize=False)),
                ("datetime", models.DateTimeField()),
                ("venue_name", models.TextField()),
                (
                    "borough",
                    models.TextField(
                        choices=[
                            ("BK", "Brooklyn"),
                            ("MN", "Manhattan"),
                            ("BX", "The Bronx"),
                            ("QN", "Queens"),
                            ("SI", "Staten Island"),
                        ]
                    ),
                ),
                ("performer_names", models.TextField()),
                ("genres", models.TextField()),
                ("event_url", models.URLField(max_length=100000)),
                ("performer_image_url", models.URLField(max_length=100000, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="Genre",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("genre", models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name="Swipe",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("direction", models.BooleanField()),
                (
                    "event",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="event",
                        to="showup.Concert",
                    ),
                ),
                (
                    "swipee",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="swipee",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "swiper",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="swiper",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="customuser",
            name="genres",
            field=models.ManyToManyField(related_name="genres", to="showup.Genre"),
        ),
        migrations.AddField(
            model_name="customuser",
            name="going",
            field=models.ManyToManyField(
                blank=True, related_name="going", to="showup.Concert"
            ),
        ),
        migrations.AddField(
            model_name="customuser",
            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="customuser",
            name="interested",
            field=models.ManyToManyField(
                blank=True, related_name="interested", to="showup.Concert"
            ),
        ),
        migrations.AddField(
            model_name="customuser",
            name="swipes",
            field=models.ManyToManyField(
                through="showup.Swipe", to=settings.AUTH_USER_MODEL
            ),
        ),
        migrations.AddField(
            model_name="customuser",
            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",
            ),
        ),
        migrations.AddConstraint(
            model_name="swipe",
            constraint=models.UniqueConstraint(
                fields=("swiper", "swipee", "event"),
                name="You can only swipe on another particular person for aparticular event once",
            ),
        ),
    ]
예제 #17
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Author',
            fields=[],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=(settings.AUTH_USER_MODEL.lower(), models.Model),
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('language',
                 models.CharField(choices=get_language_choices(),
                                  db_index=True,
                                  default=get_language_default(),
                                  max_length=8,
                                  verbose_name='language')),
                ('title',
                 models.CharField(default='',
                                  max_length=255,
                                  verbose_name='title')),
                ('slug', models.SlugField(max_length=255,
                                          verbose_name='slug')),
                ('lead',
                 models.TextField(
                     blank=True,
                     help_text='Lead paragraph, mostly used for SEO purposes.',
                     verbose_name='lead')),
                ('description',
                 models.TextField(blank=True, verbose_name='description')),
                ('cover',
                 models.ImageField(blank=True,
                                   default='',
                                   max_length=255,
                                   upload_to='lotus/category/cover/%y/%m',
                                   verbose_name='cover image')),
                ('original',
                 models.ForeignKey(
                     blank=True,
                     default=None,
                     help_text=
                     'Mark this article as a translation of original article.',
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to='lotus.category')),
            ],
            options={
                'verbose_name': 'Category',
                'verbose_name_plural': 'Categories',
                'ordering': ['title'],
            },
        ),
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('language',
                 models.CharField(choices=get_language_choices(),
                                  db_index=True,
                                  default=get_language_default(),
                                  max_length=8,
                                  verbose_name='language')),
                ('status',
                 models.SmallIntegerField(choices=get_status_choices(),
                                          db_index=True,
                                          default=get_status_default(),
                                          help_text='Publication status.',
                                          verbose_name='status')),
                ('featured',
                 models.BooleanField(
                     blank=True,
                     default=False,
                     help_text='Mark this article as featured.',
                     verbose_name='featured')),
                ('pinned',
                 models.BooleanField(
                     blank=True,
                     default=False,
                     help_text=
                     'A pinned article is enforced at top of order results.',
                     verbose_name='pinned')),
                ('private',
                 models.BooleanField(
                     blank=True,
                     default=False,
                     help_text=
                     'Private article is only available for authenticated users.',
                     verbose_name='private')),
                ('publish_date',
                 models.DateField(db_index=True,
                                  default=django.utils.timezone.now,
                                  help_text='Start date of publication.',
                                  verbose_name='publication date')),
                ('publish_time',
                 models.TimeField(default=django.utils.timezone.now,
                                  help_text='Start time of publication.',
                                  verbose_name='publication time')),
                ('publish_end',
                 models.DateTimeField(blank=True,
                                      db_index=True,
                                      default=None,
                                      help_text='End date of publication.',
                                      null=True,
                                      verbose_name='publication end')),
                ('last_update',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='last update')),
                ('title',
                 models.CharField(default='',
                                  max_length=150,
                                  verbose_name='title')),
                ('slug',
                 models.SlugField(help_text="Used to build the entry's URL.",
                                  max_length=255,
                                  verbose_name='slug')),
                ('lead',
                 models.TextField(
                     blank=True,
                     help_text='Lead paragraph, mostly used for SEO purposes.',
                     verbose_name='lead')),
                ('introduction',
                 models.TextField(blank=True, verbose_name='introduction')),
                ('content',
                 models.TextField(blank=True,
                                  default='',
                                  verbose_name='content')),
                ('cover',
                 models.ImageField(blank=True,
                                   default='',
                                   help_text='Article cover image.',
                                   max_length=255,
                                   upload_to='lotus/article/cover/%y/%m',
                                   verbose_name='cover image')),
                ('image',
                 models.ImageField(blank=True,
                                   default='',
                                   help_text='Article large image.',
                                   max_length=255,
                                   upload_to='lotus/article/image/%y/%m',
                                   verbose_name='main image')),
                ('authors',
                 models.ManyToManyField(blank=True,
                                        related_name='articles',
                                        to='lotus.Author',
                                        verbose_name='authors')),
                ('categories',
                 models.ManyToManyField(blank=True,
                                        related_name='articles',
                                        to='lotus.Category',
                                        verbose_name='categories')),
                ('original',
                 models.ForeignKey(
                     blank=True,
                     default=None,
                     help_text=
                     'Mark this article as a translation of original article.',
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to='lotus.article',
                     verbose_name='original article')),
                ('related',
                 models.ManyToManyField(blank=True,
                                        related_name='relations',
                                        to='lotus.Article',
                                        verbose_name='related articles')),
            ],
            options={
                'verbose_name': 'Article',
                'verbose_name_plural': 'Articles',
                'ordering': ['-publish_date', '-publish_time', '-title'],
            },
        ),
        migrations.AddConstraint(
            model_name='category',
            constraint=models.UniqueConstraint(
                fields=('slug', 'language'),
                name='lotus_unique_cat_slug_lang'),
        ),
        migrations.AddConstraint(
            model_name='category',
            constraint=models.UniqueConstraint(
                fields=('original', 'language'),
                name='lotus_unique_cat_original_lang'),
        ),
        migrations.AddConstraint(
            model_name='article',
            constraint=models.UniqueConstraint(
                fields=('publish_date', 'slug', 'language'),
                name='lotus_unique_art_pub_slug_lang'),
        ),
        migrations.AddConstraint(
            model_name='article',
            constraint=models.UniqueConstraint(
                fields=('original', 'language'),
                name='lotus_unique_art_original_lang'),
        ),
    ]
예제 #18
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    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=30,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='last name')),
                ('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')),
                ('email', models.CharField(max_length=256)),
                ('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='Caseload',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=1024)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CaseType',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('code', models.CharField(max_length=5, unique=True)),
                ('name', models.CharField(max_length=256)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Client',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('first_name', models.CharField(max_length=256)),
                ('last_name', models.CharField(max_length=256)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=150, unique=True)),
                ('permissions',
                 models.ManyToManyField(blank=True, to='auth.Permission')),
            ],
            options={
                'verbose_name': 'Role',
                'verbose_name_plural': 'Roles',
            },
            managers=[
                ('objects', django.contrib.auth.models.GroupManager()),
            ],
        ),
        migrations.CreateModel(
            name='DocumentTemplate',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('code', models.CharField(max_length=10)),
                ('name', models.CharField(max_length=256)),
                ('filename', models.CharField(max_length=1024)),
                ('case_type',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='document_templates',
                                   to='casemgmt.casetype')),
            ],
        ),
        migrations.CreateModel(
            name='Document',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
                ('content', models.TextField(null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('client',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='documents',
                                   to='casemgmt.client')),
                ('template',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='documents',
                                   to='casemgmt.documenttemplate')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CaseloadRole',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('caseload',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='caseload_roles',
                                   to='casemgmt.caseload')),
                ('groups',
                 models.ManyToManyField(blank=True,
                                        related_name='caseload_roles',
                                        to='auth.Group')),
                ('role',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='caseload_roles',
                                   to='casemgmt.role')),
                ('users',
                 models.ManyToManyField(blank=True,
                                        related_name='caseload_roles',
                                        to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='caseload',
            name='case_types',
            field=models.ManyToManyField(related_name='caseloads',
                                         to='casemgmt.CaseType'),
        ),
        migrations.AddField(
            model_name='caseload',
            name='clients',
            field=models.ManyToManyField(related_name='caseloads',
                                         to='casemgmt.Client'),
        ),
        migrations.AddConstraint(
            model_name='documenttemplate',
            constraint=models.UniqueConstraint(fields=('code', 'case_type'),
                                               name='code_case_type'),
        ),
    ]
예제 #19
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='users',
            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')),
                ('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='cuisines',
            fields=[
                ('cuisine_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('cuisine_name', models.CharField(max_length=50, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='ingredients',
            fields=[
                ('ingredient_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('ingredient_name', models.CharField(max_length=50,
                                                     unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='recipes',
            fields=[
                ('recipe_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('recipe_name', models.CharField(max_length=50)),
                ('cooking_method', models.TextField()),
                ('image', models.TextField(null=True)),
                ('string_ingredients', models.TextField(null=True)),
                ('prep_time', models.TextField(null=True)),
                ('serving', models.TextField(null=True)),
            ],
        ),
        migrations.CreateModel(
            name='tags',
            fields=[
                ('tag_id', models.AutoField(primary_key=True,
                                            serialize=False)),
                ('tag_name', models.CharField(max_length=50, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='user_recipes',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('recipe_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='recipes.recipes')),
                ('users_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='recipe_tags',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('recipe_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='recipes.recipes')),
                ('tag_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='recipes.tags')),
            ],
        ),
        migrations.CreateModel(
            name='recipe_ingredients',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('ingredient_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='recipes.ingredients')),
                ('recipe_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='recipes.recipes')),
            ],
        ),
        migrations.CreateModel(
            name='recipe_cuisines',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('cuisine_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='recipes.cuisines')),
                ('recipe_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='recipes.recipes')),
            ],
        ),
        migrations.AddConstraint(
            model_name='user_recipes',
            constraint=models.UniqueConstraint(
                fields=('recipe_id', 'users_id'),
                name='user_recipes_id_constraint'),
        ),
        migrations.AddConstraint(
            model_name='recipe_tags',
            constraint=models.UniqueConstraint(
                fields=('recipe_id', 'tag_id'),
                name='recipe_tags_id_constraint'),
        ),
        migrations.AddConstraint(
            model_name='recipe_ingredients',
            constraint=models.UniqueConstraint(
                fields=('recipe_id', 'ingredient_id'),
                name='recipe_ingredients_id_constraint'),
        ),
        migrations.AddConstraint(
            model_name='recipe_cuisines',
            constraint=models.UniqueConstraint(
                fields=('recipe_id', 'cuisine_id'),
                name='recipe_cuisine_id_constraint'),
        ),
    ]
예제 #20
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='User',
            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')),
                ('patronymic', models.CharField(blank=True, max_length=150, verbose_name='Отчество')),
                ('balance', models.DecimalField(decimal_places=2, default=0, max_digits=9, verbose_name='Баланс')),
                ('passport_number', models.CharField(blank=True, max_length=15, verbose_name='Номер паспорта')),
                ('passport_data', models.CharField(blank=True, max_length=195, verbose_name='Паспортные данные')),
                ('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='Article',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=180, verbose_name='Заголовок')),
                ('slug', models.SlugField(max_length=200, unique=True, verbose_name='Slug( URL )')),
                ('short_description', models.TextField(max_length=400, verbose_name='Краткое описание статьи')),
                ('text', ckeditor_uploader.fields.RichTextUploadingField(verbose_name='Текст')),
                ('active', models.BooleanField(verbose_name='Активна')),
            ],
            options={
                'verbose_name': 'Статья',
                'verbose_name_plural': 'Статьи',
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='Coach',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, verbose_name='Имя')),
                ('description', models.TextField(verbose_name='Описание')),
                ('photo', models.ImageField(blank=True, upload_to='photos_of_coaches/', verbose_name='Фото')),
                ('active', models.BooleanField(verbose_name='Активный')),
            ],
            options={
                'verbose_name': 'Тренер',
                'verbose_name_plural': 'Тренеры',
            },
        ),
        migrations.CreateModel(
            name='Court',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=120, verbose_name='Наименование')),
                ('description', models.TextField(blank=True, verbose_name='Описание')),
                ('address', models.CharField(max_length=120, verbose_name='Адрес')),
                ('metro', models.CharField(max_length=50, verbose_name='Станция метро')),
                ('photo', models.ImageField(blank=True, upload_to='photos_of_courts/', verbose_name='Фото')),
                ('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True, verbose_name='Долгота')),
                ('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True, verbose_name='Широта')),
                ('passport_required', models.BooleanField(verbose_name='Требуется паспорт')),
                ('active', models.BooleanField(verbose_name='Активный')),
            ],
            options={
                'verbose_name': 'Зал',
                'verbose_name_plural': 'Залы',
            },
        ),
        migrations.CreateModel(
            name='News',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=120, verbose_name='Заголовок')),
                ('date', models.DateField(auto_now_add=True, verbose_name='Дата')),
                ('text', models.TextField(blank=True, verbose_name='Текст')),
                ('image', models.ImageField(blank=True, upload_to='news_images/', verbose_name='Изображение')),
            ],
            options={
                'verbose_name': 'Новость',
                'verbose_name_plural': 'Новости',
                'ordering': ['-date'],
            },
        ),
        migrations.CreateModel(
            name='OneTimeTraining',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('price', models.PositiveSmallIntegerField(verbose_name='Цена(руб.)')),
            ],
            options={
                'verbose_name': 'Стоимость разового занятия',
                'verbose_name_plural': 'Стоимость разового занятия',
            },
        ),
        migrations.CreateModel(
            name='SubscriptionSample',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=80, verbose_name='Наименование')),
                ('amount', models.PositiveIntegerField(verbose_name='Стоимость(руб.)')),
                ('trainings_qty', models.PositiveSmallIntegerField(verbose_name='Количество тренировок')),
                ('validity', models.PositiveSmallIntegerField(verbose_name='Срок действия(дней)')),
                ('active', models.BooleanField(verbose_name='Активный')),
            ],
            options={
                'verbose_name': 'Абонемент',
                'verbose_name_plural': 'Абонементы',
            },
        ),
        migrations.CreateModel(
            name='Training',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('day_of_week', models.SmallIntegerField(choices=[(1, 'Понедельник'), (2, 'Вторник'), (3, 'Среда'), (4, 'Четверг'), (5, 'Пятница'), (6, 'Суббота'), (7, 'Воскресенье')], verbose_name='день недели')),
                ('skill_level', models.SmallIntegerField(choices=[(1, 'начальный уровень'), (2, 'уровень начальный+'), (3, 'средний уровень')], verbose_name='уровень')),
                ('start_time', models.TimeField(verbose_name='время начала')),
                ('active', models.BooleanField(default=True, verbose_name='активно')),
                ('status', models.SmallIntegerField(choices=[(1, 'OK'), (2, 'замена тренера'), (3, 'перенос по времени'), (4, 'отменена')], default=1, verbose_name='статус')),
                ('date', models.DateField(verbose_name='Дата')),
                ('coach', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to='volleyballschool.coach', verbose_name='тренер')),
                ('court', models.ForeignKey(limit_choices_to={'active': True}, on_delete=django.db.models.deletion.CASCADE, to='volleyballschool.court', verbose_name='зал')),
                ('learners', models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL, verbose_name='Посетители')),
            ],
            options={
                'verbose_name': 'Тренировка',
                'verbose_name_plural': 'Тренировки',
            },
        ),
        migrations.CreateModel(
            name='Timetable',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('day_of_week', models.SmallIntegerField(choices=[(1, 'Понедельник'), (2, 'Вторник'), (3, 'Среда'), (4, 'Четверг'), (5, 'Пятница'), (6, 'Суббота'), (7, 'Воскресенье')], verbose_name='день недели')),
                ('skill_level', models.SmallIntegerField(choices=[(1, 'начальный уровень'), (2, 'уровень начальный+'), (3, 'средний уровень')], verbose_name='уровень')),
                ('start_time', models.TimeField(verbose_name='время начала')),
                ('active', models.BooleanField(default=True, verbose_name='активно')),
                ('coach', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to='volleyballschool.coach', verbose_name='тренер')),
                ('court', models.ForeignKey(limit_choices_to={'active': True}, on_delete=django.db.models.deletion.CASCADE, to='volleyballschool.court', verbose_name='зал')),
            ],
            options={
                'verbose_name': 'Расписание',
                'verbose_name_plural': 'Расписание',
            },
        ),
        migrations.AddConstraint(
            model_name='training',
            constraint=models.UniqueConstraint(fields=('skill_level', 'court', 'date'), name='unique_training'),
        ),
    ]
예제 #21
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')),
                ('bio', models.TextField(blank=True, max_length=500,
                                         null=True)),
                ('image',
                 models.ImageField(blank=True, null=True,
                                   upload_to='user_pic')),
                ('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='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at',
                 models.DateTimeField(auto_now_add=True, null=True)),
                ('updated_at', models.DateTimeField(auto_now=True, null=True)),
                ('content', models.TextField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at',
                 models.DateTimeField(auto_now_add=True, null=True)),
                ('updated_at', models.DateTimeField(auto_now=True, null=True)),
                ('title', models.CharField(max_length=260)),
                ('text', models.TextField()),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='posts',
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Notification',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at',
                 models.DateTimeField(auto_now_add=True, null=True)),
                ('updated_at', models.DateTimeField(auto_now=True, null=True)),
                ('category', models.TextField()),
                ('read', models.BooleanField(default=False)),
                ('comment',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.comment')),
                ('post',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='api.post')),
                ('recipient',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='notifications',
                                   to=settings.AUTH_USER_MODEL)),
                ('sender',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='sent_notifications',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Like',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('post',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='likes',
                                   to='api.post')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='likers',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Following',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('follower',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='targets',
                                   to=settings.AUTH_USER_MODEL)),
                ('target',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='followers',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='comment',
            name='post',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='comments',
                to='api.post'),
        ),
        migrations.AddField(
            model_name='comment',
            name='user',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='comments',
                to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddConstraint(
            model_name='notification',
            constraint=models.UniqueConstraint(
                condition=models.Q(category='new_follow'),
                fields=('sender', 'recipient'),
                name='unique_field_follow'),
        ),
        migrations.AddConstraint(
            model_name='notification',
            constraint=models.UniqueConstraint(
                condition=models.Q(category='new_like'),
                fields=('sender', 'recipient', 'post'),
                name='unique_field_like'),
        ),
        migrations.AlterUniqueTogether(
            name='like',
            unique_together={('user', 'post')},
        ),
        migrations.AlterUniqueTogether(
            name='following',
            unique_together={('target', 'follower')},
        ),
    ]
예제 #22
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('mainapp', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name',
                 models.CharField(max_length=40,
                                  unique=True,
                                  verbose_name='name')),
                ('category',
                 models.ForeignKey(
                     blank=True,
                     limit_choices_to={'category__isnull': True},
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='categories',
                     to='shop.category',
                     verbose_name='parent category')),
                ('content_type',
                 models.ForeignKey(limit_choices_to={
                     'app_label': 'shop',
                     'model__endswith': 'product'
                 },
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='contenttypes.contenttype')),
            ],
            options={
                'verbose_name_plural': 'categories',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('status',
                 models.PositiveIntegerField(
                     choices=[(1, 'Cart'), (2, 'Processing'), (
                         3, 'Shipping'), (4, 'Finished'), (5, 'Canceled')])),
                ('address', models.TextField(blank=True)),
                ('order_cost',
                 models.DecimalField(
                     decimal_places=2,
                     default=Decimal('0'),
                     max_digits=9,
                     validators=[
                         django.core.validators.MinValueValidator(Decimal('0'))
                     ])),
                ('reserved', models.BooleanField(default=False)),
                ('order_date', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='Account',
            fields=[],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('mainapp.customuser', ),
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='TvProduct',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name', models.CharField(max_length=40)),
                ('marking',
                 models.CharField(
                     help_text='Model or the main feature of the product.',
                     max_length=40)),
                ('image',
                 models.ImageField(
                     help_text=
                     'Minimal image sizes is 600x600 pixels. Max upload file size up to 3 MB.',
                     upload_to=shop.services.get_file_directory_path,
                     validators=[shop.services.validate_image_size])),
                ('description', models.TextField(blank=True)),
                ('unit',
                 models.CharField(choices=[
                     ('Weight', (('KG', 'kilo'), ('LB', 'pound'))),
                     ('Volume', (('L', 'liter'), ('GAL', 'gallon'))),
                     ('PC', 'piece'), ('PCK', 'pack'), ('PR', 'pair'),
                     ('BTL', 'bottle'), ('LT', 'lot')
                 ],
                                  default='PC',
                                  max_length=3)),
                ('unit_for_weight_vol',
                 models.CharField(choices=[
                     ('Weight', (('KG', 'kilo'), ('LB', 'pound'))),
                     ('Volume', (('L', 'liter'), ('GAL', 'gallon'))),
                     ('PC', 'piece'), ('PCK', 'pack'), ('PR', 'pair'),
                     ('BTL', 'bottle'), ('LT', 'lot')
                 ],
                                  default='KG',
                                  max_length=3,
                                  verbose_name='unit for weight/volume')),
                ('date_added', models.DateField(auto_now_add=True)),
                ('screen_diagonal', models.CharField(max_length=10)),
                ('screen_resolution', models.CharField(max_length=20)),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   related_name='+',
                                   to='shop.category')),
            ],
            options={
                'verbose_name': 'TV',
                'ordering': ['-date_added'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Specification',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('tag', models.CharField(blank=True, max_length=20)),
                ('image',
                 models.ImageField(
                     blank=True,
                     help_text=
                     'Minimal image sizes is 600x600 pixels. Max upload file size up to 3 MB.',
                     upload_to=shop.services.get_file_directory_path,
                     validators=[shop.services.validate_image_size])),
                ('pre_packing',
                 models.DecimalField(
                     decimal_places=3,
                     default='1',
                     max_digits=6,
                     validators=[
                         django.core.validators.MinValueValidator(
                             Decimal('0.001'))
                     ],
                     verbose_name='pre-packing')),
                ('weight_vol',
                 models.DecimalField(
                     decimal_places=3,
                     max_digits=6,
                     validators=[
                         django.core.validators.MinValueValidator(
                             Decimal('0.001'))
                     ],
                     verbose_name='weight/volume')),
                ('price',
                 models.DecimalField(
                     decimal_places=2,
                     max_digits=9,
                     validators=[
                         django.core.validators.MinValueValidator(
                             Decimal('0.01'))
                     ])),
                ('discount',
                 models.IntegerField(
                     default=0,
                     help_text='A discount from 0 to 99%.',
                     validators=[
                         django.core.validators.MinValueValidator(0),
                         django.core.validators.MaxValueValidator(99)
                     ])),
                ('discount_price',
                 models.DecimalField(decimal_places=2,
                                     default=Decimal('0'),
                                     editable=False,
                                     max_digits=9)),
                ('sale_price',
                 models.DecimalField(
                     decimal_places=2,
                     default=Decimal('0'),
                     help_text=
                     'Special price replaces the discount price, 0 is disabled',
                     max_digits=9,
                     validators=[
                         django.core.validators.MinValueValidator(Decimal('0'))
                     ])),
                ('available_qty',
                 models.DecimalField(
                     decimal_places=3,
                     max_digits=6,
                     validators=[
                         django.core.validators.MinValueValidator(Decimal('0'))
                     ],
                     verbose_name='available quantity')),
                ('addition',
                 models.CharField(blank=True,
                                  max_length=100,
                                  verbose_name='additional information')),
                ('date_added', models.DateField(auto_now_add=True)),
                ('object_id', models.PositiveIntegerField()),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   related_name='specs',
                                   to='shop.category')),
                ('content_type',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='contenttypes.contenttype')),
            ],
        ),
        migrations.CreateModel(
            name='SmartphoneProduct',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name', models.CharField(max_length=40)),
                ('marking',
                 models.CharField(
                     help_text='Model or the main feature of the product.',
                     max_length=40)),
                ('image',
                 models.ImageField(
                     help_text=
                     'Minimal image sizes is 600x600 pixels. Max upload file size up to 3 MB.',
                     upload_to=shop.services.get_file_directory_path,
                     validators=[shop.services.validate_image_size])),
                ('description', models.TextField(blank=True)),
                ('unit',
                 models.CharField(choices=[
                     ('Weight', (('KG', 'kilo'), ('LB', 'pound'))),
                     ('Volume', (('L', 'liter'), ('GAL', 'gallon'))),
                     ('PC', 'piece'), ('PCK', 'pack'), ('PR', 'pair'),
                     ('BTL', 'bottle'), ('LT', 'lot')
                 ],
                                  default='PC',
                                  max_length=3)),
                ('unit_for_weight_vol',
                 models.CharField(choices=[
                     ('Weight', (('KG', 'kilo'), ('LB', 'pound'))),
                     ('Volume', (('L', 'liter'), ('GAL', 'gallon'))),
                     ('PC', 'piece'), ('PCK', 'pack'), ('PR', 'pair'),
                     ('BTL', 'bottle'), ('LT', 'lot')
                 ],
                                  default='KG',
                                  max_length=3,
                                  verbose_name='unit for weight/volume')),
                ('date_added', models.DateField(auto_now_add=True)),
                ('ram', models.CharField(max_length=30)),
                ('memory', models.CharField(max_length=30)),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   related_name='+',
                                   to='shop.category')),
            ],
            options={
                'verbose_name': 'smartphone',
                'ordering': ['-date_added'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ShippingAddress',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('full_name', models.CharField(max_length=90)),
                ('address', models.CharField(max_length=255)),
                ('city', models.CharField(max_length=60)),
                ('region', models.CharField(max_length=60)),
                ('postcode', models.CharField(max_length=10)),
                ('country', models.CharField(max_length=60)),
                ('phone', models.CharField(max_length=20)),
                ('by_default', models.BooleanField(default=False)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='addresses',
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'shipping addresses',
            },
        ),
        migrations.CreateModel(
            name='Rate',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('point',
                 models.IntegerField(choices=[(1, 'One'), (
                     2, 'Two'), (3, 'Three'), (4, 'Four'), (5, 'Five')])),
                ('review', models.TextField(blank=True)),
                ('object_id', models.PositiveIntegerField()),
                ('content_type',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='contenttypes.contenttype')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='OrderItem',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('quantity',
                 models.DecimalField(
                     decimal_places=3,
                     max_digits=6,
                     validators=[
                         django.core.validators.MinValueValidator(Decimal('0'))
                     ])),
                ('price',
                 models.DecimalField(
                     decimal_places=2,
                     max_digits=9,
                     validators=[
                         django.core.validators.MinValueValidator(
                             Decimal('0.01'))
                     ])),
                ('order',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='shop.order')),
                ('specification',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='shop.specification')),
            ],
        ),
        migrations.AddField(
            model_name='order',
            name='specs',
            field=models.ManyToManyField(through='shop.OrderItem',
                                         to='shop.Specification'),
        ),
        migrations.AddField(
            model_name='order',
            name='user',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='FoodProduct',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name', models.CharField(max_length=40)),
                ('marking',
                 models.CharField(
                     help_text='Model or the main feature of the product.',
                     max_length=40)),
                ('image',
                 models.ImageField(
                     help_text=
                     'Minimal image sizes is 600x600 pixels. Max upload file size up to 3 MB.',
                     upload_to=shop.services.get_file_directory_path,
                     validators=[shop.services.validate_image_size])),
                ('description', models.TextField(blank=True)),
                ('unit',
                 models.CharField(choices=[
                     ('Weight', (('KG', 'kilo'), ('LB', 'pound'))),
                     ('Volume', (('L', 'liter'), ('GAL', 'gallon'))),
                     ('PC', 'piece'), ('PCK', 'pack'), ('PR', 'pair'),
                     ('BTL', 'bottle'), ('LT', 'lot')
                 ],
                                  default='PC',
                                  max_length=3)),
                ('unit_for_weight_vol',
                 models.CharField(choices=[
                     ('Weight', (('KG', 'kilo'), ('LB', 'pound'))),
                     ('Volume', (('L', 'liter'), ('GAL', 'gallon'))),
                     ('PC', 'piece'), ('PCK', 'pack'), ('PR', 'pair'),
                     ('BTL', 'bottle'), ('LT', 'lot')
                 ],
                                  default='KG',
                                  max_length=3,
                                  verbose_name='unit for weight/volume')),
                ('date_added', models.DateField(auto_now_add=True)),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   related_name='+',
                                   to='shop.category')),
            ],
            options={
                'verbose_name': 'foodstuff',
                'ordering': ['-date_added'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ClothingProduct',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name', models.CharField(max_length=40)),
                ('marking',
                 models.CharField(
                     help_text='Model or the main feature of the product.',
                     max_length=40)),
                ('image',
                 models.ImageField(
                     help_text=
                     'Minimal image sizes is 600x600 pixels. Max upload file size up to 3 MB.',
                     upload_to=shop.services.get_file_directory_path,
                     validators=[shop.services.validate_image_size])),
                ('description', models.TextField(blank=True)),
                ('unit',
                 models.CharField(choices=[
                     ('Weight', (('KG', 'kilo'), ('LB', 'pound'))),
                     ('Volume', (('L', 'liter'), ('GAL', 'gallon'))),
                     ('PC', 'piece'), ('PCK', 'pack'), ('PR', 'pair'),
                     ('BTL', 'bottle'), ('LT', 'lot')
                 ],
                                  default='PC',
                                  max_length=3)),
                ('unit_for_weight_vol',
                 models.CharField(choices=[
                     ('Weight', (('KG', 'kilo'), ('LB', 'pound'))),
                     ('Volume', (('L', 'liter'), ('GAL', 'gallon'))),
                     ('PC', 'piece'), ('PCK', 'pack'), ('PR', 'pair'),
                     ('BTL', 'bottle'), ('LT', 'lot')
                 ],
                                  default='KG',
                                  max_length=3,
                                  verbose_name='unit for weight/volume')),
                ('date_added', models.DateField(auto_now_add=True)),
                ('type',
                 models.CharField(choices=[('M', 'Men'), ('W', 'Women'),
                                           ('K', 'Kids')],
                                  max_length=1)),
                ('size',
                 models.CharField(blank=True,
                                  choices=[('S', 'S'), ('M', 'M'), ('L', 'L'),
                                           ('XL', 'XL'), ('2X', 'XXL')],
                                  max_length=2)),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   related_name='+',
                                   to='shop.category')),
            ],
            options={
                'verbose_name': 'clothing',
                'verbose_name_plural': 'clothing',
                'ordering': ['-date_added'],
                'abstract': False,
            },
        ),
        migrations.AddIndex(
            model_name='tvproduct',
            index=django.contrib.postgres.indexes.GinIndex(
                django.contrib.postgres.search.SearchVector('name',
                                                            'marking',
                                                            config='english'),
                name='tvproduct_vector_idx'),
        ),
        migrations.AddIndex(
            model_name='specification',
            index=django.contrib.postgres.indexes.GinIndex(
                django.contrib.postgres.search.SearchVector('tag',
                                                            config='english'),
                name='shop_specification_vector_idx'),
        ),
        migrations.AddConstraint(
            model_name='specification',
            constraint=models.CheckConstraint(check=models.Q(
                ('available_qty__gte', 0)),
                                              name='qty_gte_0'),
        ),
        migrations.AddIndex(
            model_name='smartphoneproduct',
            index=django.contrib.postgres.indexes.GinIndex(
                django.contrib.postgres.search.SearchVector('name',
                                                            'marking',
                                                            config='english'),
                name='smartphoneproduct_vector_idx'),
        ),
        migrations.AddConstraint(
            model_name='shippingaddress',
            constraint=models.UniqueConstraint(condition=models.Q(
                ('by_default', True)),
                                               fields=('user', ),
                                               name='unique_default_address'),
        ),
        migrations.AddConstraint(
            model_name='rate',
            constraint=models.UniqueConstraint(fields=('user', 'object_id'),
                                               name='user_rate_unique'),
        ),
        migrations.AddConstraint(
            model_name='orderitem',
            constraint=models.UniqueConstraint(fields=('order',
                                                       'specification'),
                                               name='order_item_unique'),
        ),
        migrations.AddConstraint(
            model_name='order',
            constraint=models.UniqueConstraint(condition=models.Q(
                ('status', 1)),
                                               fields=('user', ),
                                               name='unique_user_cart'),
        ),
        migrations.AddIndex(
            model_name='foodproduct',
            index=django.contrib.postgres.indexes.GinIndex(
                django.contrib.postgres.search.SearchVector('name',
                                                            'marking',
                                                            config='english'),
                name='foodproduct_vector_idx'),
        ),
        migrations.AddIndex(
            model_name='clothingproduct',
            index=django.contrib.postgres.indexes.GinIndex(
                django.contrib.postgres.search.SearchVector('name',
                                                            'marking',
                                                            config='english'),
                name='clothingproduct_vector_idx'),
        ),
        migrations.AddIndex(
            model_name='category',
            index=django.contrib.postgres.indexes.GinIndex(
                django.contrib.postgres.search.SearchVector('name',
                                                            config='english'),
                name='shop_category_vector_idx'),
        ),
    ]
예제 #23
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='MrMapUser',
            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')),
                ('salt', models.CharField(max_length=500)),
                ('confirmed_newsletter',
                 models.BooleanField(
                     default=False,
                     verbose_name='I want to sign up for the newsletter')),
                ('confirmed_survey',
                 models.BooleanField(
                     default=False,
                     verbose_name='I want to participate in surveys')),
                ('confirmed_dsgvo',
                 models.DateTimeField(
                     auto_now_add=True,
                     verbose_name=
                     'I understand and accept that my data will be automatically processed and securely stored, as it is stated in the general data protection regulation (GDPR).'
                 )),
                ('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')),
            ],
            options={
                'verbose_name': 'User',
                'verbose_name_plural': 'Users',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Organization',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('person_name',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=200,
                                  null=True,
                                  verbose_name='Contact person')),
                ('email',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=100,
                                  null=True,
                                  verbose_name='E-Mail')),
                ('phone',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=100,
                                  null=True,
                                  verbose_name='Phone')),
                ('facsimile',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=100,
                                  null=True,
                                  verbose_name='Facsimile')),
                ('city',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=100,
                                  null=True,
                                  verbose_name='City')),
                ('postal_code',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=100,
                                  null=True,
                                  verbose_name='Postal code')),
                ('address_type',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=100,
                                  null=True,
                                  verbose_name='Address type')),
                ('address',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=100,
                                  null=True,
                                  verbose_name='Address')),
                ('state_or_province',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=100,
                                  null=True,
                                  verbose_name='State or province')),
                ('country',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=100,
                                  null=True,
                                  verbose_name='Country')),
                ('organization_name',
                 models.CharField(default='',
                                  max_length=255,
                                  null=True,
                                  verbose_name='Organization name')),
                ('description',
                 models.TextField(blank=True,
                                  default='',
                                  null=True,
                                  verbose_name='description')),
                ('is_auto_generated',
                 models.BooleanField(
                     default=True,
                     help_text=
                     'Autogenerated organizations are resolved from registered resources.',
                     verbose_name='autogenerated')),
                ('created_by',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='created_by',
                     to=settings.AUTH_USER_MODEL)),
                ('parent',
                 models.ForeignKey(
                     blank=True,
                     help_text=
                     'Configure a inheritance structure for this Organization',
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='structure.organization',
                     verbose_name='Parent organization')),
            ],
            options={
                'verbose_name': 'Organization',
                'verbose_name_plural': 'Organizations',
                'ordering': ['organization_name'],
                'permissions': [('remove_publisher', 'Can remove publisher')],
            },
        ),
        migrations.CreateModel(
            name='UserActivation',
            fields=[
                ('activation_until',
                 models.DateTimeField(default=datetime.datetime(
                     2021, 5, 13, 7, 35, 25, 446345, tzinfo=utc))),
                ('activation_hash',
                 models.CharField(max_length=500,
                                  primary_key=True,
                                  serialize=False)),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
            bases=(models.Model,
                   django.contrib.auth.tokens.PasswordResetTokenGenerator),
        ),
        migrations.CreateModel(
            name='MrMapGroup',
            fields=[
                ('group_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='auth.group')),
                ('description',
                 models.TextField(blank=True, verbose_name='Description')),
                ('is_public_group', models.BooleanField(default=False)),
                ('is_permission_group', models.BooleanField(default=False)),
                ('created_by',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to=settings.AUTH_USER_MODEL)),
                ('organization',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='organization_groups',
                                   to='structure.organization')),
                ('parent_group',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='children_groups',
                     to='structure.mrmapgroup')),
                ('publish_for_organizations',
                 models.ManyToManyField(blank=True,
                                        related_name='publishers',
                                        to='structure.Organization')),
            ],
            options={
                'verbose_name':
                'Group',
                'verbose_name_plural':
                'Groups',
                'ordering': [
                    django.db.models.expressions.Case(
                        django.db.models.expressions.When(name='Public',
                                                          then=0)), 'name'
                ],
                'permissions':
                [('add_user_to_group', 'Can add user to a group'),
                 ('remove_user_from_group', 'Can remove user from a group'),
                 ('request_to_become_publisher',
                  'Can request to become publisher')],
            },
            bases=('auth.group', ),
            managers=[
                ('objects', django.contrib.auth.models.GroupManager()),
            ],
        ),
        migrations.CreateModel(
            name='GroupInvitationRequest',
            fields=[
                ('id',
                 models.UUIDField(default=uuid.uuid4,
                                  primary_key=True,
                                  serialize=False)),
                ('message', models.TextField(blank=True, null=True)),
                ('activation_until',
                 models.DateTimeField(default=datetime.datetime(
                     2021, 5, 13, 7, 35, 25, 447075, tzinfo=utc))),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('is_accepted',
                 models.BooleanField(default=False, verbose_name='accepted')),
                ('created_by',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='auth.group')),
                ('group',
                 models.ForeignKey(
                     help_text='Invite the selected user to this group.',
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='pending_group_invitations',
                     to='structure.mrmapgroup',
                     verbose_name='to group')),
                ('user',
                 models.ForeignKey(
                     help_text='Invite this user to a selected group.',
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='pending_group_invitations',
                     to=settings.AUTH_USER_MODEL,
                     verbose_name='Invited user')),
            ],
            options={
                'verbose_name': 'Pending group invitation',
                'verbose_name_plural': 'Pending group invitations',
            },
        ),
        migrations.CreateModel(
            name='GroupActivity',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('description',
                 models.CharField(blank=True, max_length=255, null=True)),
                ('metadata',
                 models.CharField(blank=True, max_length=255, null=True)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('group',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='auth.group')),
                ('user',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='mrmapuser',
            name='organization',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name='primary_users',
                to='structure.organization'),
        ),
        migrations.AddField(
            model_name='mrmapuser',
            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'),
        ),
        migrations.CreateModel(
            name='PublishRequest',
            fields=[
                ('id',
                 models.UUIDField(default=uuid.uuid4,
                                  primary_key=True,
                                  serialize=False)),
                ('message', models.TextField(blank=True, null=True)),
                ('activation_until',
                 models.DateTimeField(default=datetime.datetime(
                     2021, 5, 13, 7, 35, 25, 447075, tzinfo=utc))),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('is_accepted',
                 models.BooleanField(default=False, verbose_name='accepted')),
                ('created_by',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='auth.group')),
                ('group',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='pending_publish_requests',
                                   to='structure.mrmapgroup',
                                   verbose_name='group')),
                ('organization',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='pending_publish_requests',
                                   to='structure.organization',
                                   verbose_name='organization')),
            ],
            options={
                'verbose_name':
                'Pending publish request',
                'verbose_name_plural':
                'Pending publish requests',
                'permissions':
                [('toggle_publish_requests', 'Can toggle publish requests')],
                'unique_together': {('group', 'organization')},
            },
        ),
        migrations.AddConstraint(
            model_name='organization',
            constraint=models.UniqueConstraint(
                fields=('organization_name', 'person_name', 'email', 'phone',
                        'facsimile', 'city', 'postal_code', 'address_type',
                        'address', 'state_or_province', 'country',
                        'description'),
                name='unique organizations'),
        ),
        migrations.AlterUniqueTogether(
            name='groupinvitationrequest',
            unique_together={('group', 'user')},
        ),
    ]
예제 #24
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')),
                ('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='Listing',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=50)),
                ('description', models.TextField(max_length=300)),
                ('category', models.CharField(choices=[('FASHION', 'Fashion'), ('ELECTRONICS', 'Electronics'), ('SPORTS', 'Sports'), ('HOBBIES', 'Hobbies'), ('HOME', 'Home'), ('MOTORS', 'Motors'), ('ART', 'Art'), ('BUSINESS', 'Business'), ('HEALTH', 'Health'), ('BEAUTY', 'Beauty'), ('MEDIA', 'Media'), ('OTHER', 'Other')], max_length=12)),
                ('image', models.URLField(blank=True, null=True)),
                ('price', models.DecimalField(decimal_places=2, max_digits=10)),
                ('active', models.BooleanField(default=True)),
                ('time_created', models.DateTimeField(auto_now_add=True)),
                ('purchaser', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='listings', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Watchlist',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('listing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='auctions.listing')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('comment', models.TextField(max_length=150)),
                ('time', models.DateTimeField(auto_now_add=True)),
                ('listing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='auctions.listing')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Bid',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('price', models.DecimalField(decimal_places=2, max_digits=10)),
                ('time', models.DateTimeField(auto_now_add=True)),
                ('listing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bids', to='auctions.listing')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bids', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddConstraint(
            model_name='watchlist',
            constraint=models.UniqueConstraint(fields=('user', 'listing'), name='unique_watching'),
        ),
    ]
예제 #25
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Calendar',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('name',
                 models.CharField(default=django.contrib.auth.models.User,
                                  max_length=50)),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='CurrentWeek',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('start_date',
                 models.DateField(default=django.utils.timezone.now)),
                ('year_number', models.IntegerField(default=0)),
                ('month_number', models.IntegerField(default=0)),
                ('week_number', models.IntegerField(default=0)),
                ('calendar',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='calendars.calendar')),
            ],
        ),
        migrations.CreateModel(
            name='UserEvent',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('title', models.CharField(max_length=50)),
                ('description', models.TextField(blank=True)),
                ('duration',
                 models.DecimalField(decimal_places=2, default=0,
                                     max_digits=4)),
                ('start_date',
                 models.DateField(default=django.utils.timezone.now)),
                ('end_date',
                 models.DateField(default=django.utils.timezone.now)),
                ('week_number', models.IntegerField(default=0)),
                ('month_number', models.IntegerField(default=0)),
                ('classification',
                 models.CharField(blank=True,
                                  choices=[('RR', 'Road Race'),
                                           ('CR', 'Crit/Circuit Race'),
                                           ('TT', 'Time Trial'),
                                           ('HC', 'Hill Climb'),
                                           ('SP', 'Sportive'),
                                           ('US',
                                            'Ultra Sportive/Endurance Event'),
                                           ('CX', 'Cyclo Cross'),
                                           ('MTB', 'MTB CX'),
                                           ('EMTB', 'Enduro MTB'),
                                           ('ENMTB', 'Endurance MTB'),
                                           ('NT', 'No Training'),
                                           ('TC', 'Training Camp')],
                                  max_length=5)),
                ('priority',
                 models.CharField(blank=True,
                                  choices=[('A', 'A Event'), ('B', 'B Event'),
                                           ('C', 'C Event'),
                                           ('FTP', 'FTP Test')],
                                  max_length=3)),
                ('type',
                 models.CharField(choices=[('AD', 'All day'), ('AM', 'AM'),
                                           ('PM', 'PM')],
                                  default='AM',
                                  max_length=3)),
                ('calendar',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='calendars.calendar')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CurrentWeekEvent',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('title', models.CharField(max_length=50)),
                ('description', models.TextField(blank=True)),
                ('duration',
                 models.DecimalField(decimal_places=2, default=0,
                                     max_digits=4)),
                ('start_date',
                 models.DateField(default=django.utils.timezone.now)),
                ('end_date',
                 models.DateField(default=django.utils.timezone.now)),
                ('week_number', models.IntegerField(default=0)),
                ('month_number', models.IntegerField(default=0)),
                ('comments', models.CharField(blank=True, max_length=250)),
                ('day', models.CharField(blank=True, max_length=10)),
                ('day_number', models.IntegerField(default=0)),
                ('calendar',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='calendars.calendar')),
                ('current_week',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='currentweekevent',
                                   to='calendars.currentweek')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddConstraint(
            model_name='currentweek',
            constraint=models.UniqueConstraint(fields=('calendar',
                                                       'week_number'),
                                               name='unique_week'),
        ),
        migrations.AddConstraint(
            model_name='currentweek',
            constraint=models.UniqueConstraint(fields=('calendar',
                                                       'start_date'),
                                               name='unique_start'),
        ),
        migrations.AddConstraint(
            model_name='currentweek',
            constraint=models.UniqueConstraint(fields=('week_number',
                                                       'start_date'),
                                               name='unique_week_start'),
        ),
    ]
예제 #26
0
class Migration(migrations.Migration):
    initial = True

    dependencies = [
        ('cms', '0022_auto_20180620_1551'),
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='Friend',
            fields=[
                ('user_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to=settings.AUTH_USER_MODEL)),
                ('pdga_number', models.IntegerField(blank=True, null=True)),
                ('city', models.CharField(blank=True,
                                          max_length=100,
                                          null=True)),
                ('main_photo',
                 models.ImageField(blank=True, null=True, upload_to='')),
                ('nickname',
                 models.CharField(blank=True, max_length=30, null=True)),
                ('slug', models.SlugField(blank=True, max_length=30,
                                          null=True)),
            ],
            bases=('auth.user', ),
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='FriendPluginModel',
            fields=[
                ('cmsplugin_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     related_name='dgf_friendpluginmodel',
                     serialize=False,
                     to='cms.CMSPlugin')),
                ('friend',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='dgf.Friend')),
            ],
            options={
                'abstract': False,
            },
            bases=('cms.cmsplugin', ),
        ),
        migrations.AddConstraint(
            model_name='friend',
            constraint=models.UniqueConstraint(fields=('slug', ),
                                               name='unique_slug'),
        ),
    ]
예제 #27
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='MyUser',
            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')),
                ('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')),
                ('first_name', models.CharField(blank=True, max_length=50, verbose_name='First name')),
                ('last_name', models.CharField(blank=True, max_length=50, verbose_name='Last name')),
                ('bio', models.TextField(blank=True, verbose_name='Biography')),
                ('email', models.EmailField(max_length=254, unique=True, verbose_name='e-mail')),
                ('username', models.CharField(max_length=50, unique=True, verbose_name='Username')),
                ('role', models.CharField(choices=[('admin', 'Admin'), ('moderator', 'Moderator'), ('user', 'User')], default='user', max_length=50, verbose_name='User role')),
                ('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='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=300, verbose_name='Category')),
                ('slug', models.SlugField(unique=True, verbose_name='Address')),
            ],
        ),
        migrations.CreateModel(
            name='Genre',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=300, verbose_name='Genre')),
                ('slug', models.SlugField(blank=True, null=True, unique=True, verbose_name='Address')),
            ],
        ),
        migrations.CreateModel(
            name='Title',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=300, verbose_name='Name')),
                ('year', models.PositiveIntegerField(db_index=True, validators=[django.core.validators.MaxValueValidator(2021)], verbose_name='Year')),
                ('description', models.TextField(blank=True, verbose_name='Description')),
                ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='api.Category', verbose_name='Category')),
                ('genre', models.ManyToManyField(blank=True, null=True, to='api.Genre', verbose_name='Genre')),
            ],
        ),
        migrations.CreateModel(
            name='Review',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField(verbose_name='Text')),
                ('score', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(10)], verbose_name='Score')),
                ('pub_date', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='Publication date')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reviews', to=settings.AUTH_USER_MODEL, verbose_name='Author')),
                ('title', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='reviews', to='api.Title', verbose_name='Title')),
            ],
            options={
                'ordering': ('-pub_date',),
            },
        ),
        migrations.CreateModel(
            name='Comments',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.CharField(max_length=255, verbose_name='Text')),
                ('pub_date', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='Publication date')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to=settings.AUTH_USER_MODEL, verbose_name='Author')),
                ('review', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='api.Review', verbose_name='Comments')),
            ],
            options={
                'ordering': ('-pub_date',),
            },
        ),
        migrations.AddConstraint(
            model_name='review',
            constraint=models.UniqueConstraint(fields=('author', 'title'), name='unique_review'),
        ),
    ]
예제 #28
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
        ('operations', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Investor',
            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=30,
                                  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')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='InvestorGroup',
            fields=[],
            options={
                'verbose_name': 'Группа пользователей',
                'verbose_name_plural': 'Группы пользователей',
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('auth.group', ),
            managers=[
                ('objects', django.contrib.auth.models.GroupManager()),
            ],
        ),
        migrations.CreateModel(
            name='InvestmentAccount',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=256,
                                  verbose_name='Название счета')),
                ('token',
                 models.CharField(max_length=128,
                                  verbose_name='Токен для торговли')),
                ('broker_account_id',
                 models.CharField(max_length=50,
                                  verbose_name='ID инвестиционного счета')),
                ('sync_at',
                 models.DateTimeField(
                     default=datetime.datetime(1990, 1, 1, 0, 0, tzinfo=utc),
                     verbose_name='Время последней синхронизации')),
                ('creator',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='owned_investment_accounts',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Создатель счета')),
            ],
            options={
                'verbose_name': 'Инвестиционный счет',
                'verbose_name_plural': 'Инвестиционные счета',
            },
        ),
        migrations.CreateModel(
            name='CurrencyAsset',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('value',
                 models.DecimalField(decimal_places=4,
                                     default=0,
                                     max_digits=20,
                                     verbose_name='Количество')),
                ('currency',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='operations.Currency',
                                   verbose_name='Валюта')),
                ('investment_account',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='currency_assets',
                                   to='users.InvestmentAccount',
                                   verbose_name='Инвестиционный счет')),
            ],
            options={
                'verbose_name': 'Валютный актив',
                'verbose_name_plural': 'Валютные активы',
                'ordering': ('currency', ),
            },
        ),
        migrations.CreateModel(
            name='CoOwner',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('capital',
                 models.DecimalField(decimal_places=4,
                                     default=0,
                                     max_digits=20,
                                     verbose_name='Капитал')),
                ('default_share',
                 models.DecimalField(decimal_places=8,
                                     default=0,
                                     max_digits=9,
                                     verbose_name='Доля по умолчанию')),
                ('investment_account',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='co_owners',
                                   to='users.InvestmentAccount',
                                   verbose_name='Инвестиционный счет')),
                ('investor',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='co_owned_investment_accounts',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Инвестор')),
            ],
            options={
                'verbose_name': 'Совладелец',
                'verbose_name_plural': 'Совладельцы',
            },
        ),
        migrations.AddField(
            model_name='investor',
            name='default_investment_account',
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='users.InvestmentAccount',
                verbose_name='Инвестиционный счет по умолчанию'),
        ),
        migrations.AddField(
            model_name='investor',
            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='investor',
            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'),
        ),
        migrations.AddConstraint(
            model_name='investmentaccount',
            constraint=models.UniqueConstraint(fields=('name', 'creator'),
                                               name='unique_inv_name'),
        ),
        migrations.AddConstraint(
            model_name='investmentaccount',
            constraint=models.UniqueConstraint(fields=('creator', 'token'),
                                               name='unique_token'),
        ),
        migrations.AddConstraint(
            model_name='currencyasset',
            constraint=models.UniqueConstraint(fields=('investment_account',
                                                       'currency'),
                                               name='unique_currency_asset'),
        ),
        migrations.AddConstraint(
            model_name='coowner',
            constraint=models.UniqueConstraint(fields=('investor',
                                                       'investment_account'),
                                               name='co_owner_constraints'),
        ),
    ]
예제 #29
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='Challenge',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number_daily_submission', models.PositiveIntegerField(verbose_name='Nombre de soumissions quotidienne max')),
                ('name', models.CharField(max_length=200, verbose_name='Titre')),
                ('description', models.CharField(max_length=2000)),
                ('is_classification', models.BooleanField(default=False)),
                ('tuto_python', models.CharField(blank=True, default=None, max_length=200, null=True, verbose_name='Tuto python')),
                ('tuto_r', models.CharField(blank=True, default=None, max_length=200, null=True, verbose_name='Tuto R')),
            ],
        ),
        migrations.CreateModel(
            name='FileCode',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_upload', models.DateTimeField(auto_now_add=True, verbose_name='Date du téléversement')),
                ('file_uploaded', models.FileField(upload_to='uploads/%Y/%m/%d/', validators=[challenge_app.validators.validate_file_code])),
            ],
            options={
                'verbose_name': 'Fichier de code',
                'verbose_name_plural': 'Fichiers de code',
            },
        ),
        migrations.CreateModel(
            name='FileCsv',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_upload', models.DateTimeField(auto_now_add=True, verbose_name='Date du téléversement')),
                ('file_uploaded', models.FileField(upload_to='uploads/%Y/%m/%d/', validators=[challenge_app.validators.validate_file_csv])),
            ],
            options={
                'verbose_name': 'Fichier csv non téléchargeable',
                'verbose_name_plural': 'Fichiers csv non téléchargeables',
            },
        ),
        migrations.CreateModel(
            name='UserStudent',
            fields=[
                ('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Utilisateur',
            },
            bases=('auth.user',),
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='SubmissionCount',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('count_daily', models.PositiveIntegerField(verbose_name='Nombre de soumissions du jour')),
                ('count_total', models.PositiveIntegerField(verbose_name='Nombre de soumissions totales')),
                ('Challenge', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='challengecounted', to='challenge_app.Challenge')),
                ('UserStudent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='student', to='challenge_app.UserStudent')),
            ],
            options={
                'verbose_name': 'Compteur de soumissions',
                'verbose_name_plural': 'Compteurs de soumissions',
            },
        ),
        migrations.CreateModel(
            name='Submission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_submission', models.DateTimeField(auto_now_add=True, verbose_name='Date de la soumission')),
                ('score', models.FloatField(null=True)),
                ('commentaire', models.CharField(max_length=2000)),
                ('challenge', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='challenge_app.Challenge')),
                ('code', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='challenge_app.FileCode')),
                ('file_submitted', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='challenge_app.FileCsv', verbose_name='Fichier de prédiction (csv)')),
                ('submitted_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='challenge_app.UserStudent', verbose_name='Soumis par')),
            ],
            options={
                'verbose_name': 'Soumission',
            },
        ),
        migrations.CreateModel(
            name='FileCsvOpenUpload',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_upload', models.DateTimeField(auto_now_add=True, verbose_name='Date du téléversement')),
                ('file_uploaded', models.FileField(upload_to='uploads_storage/%Y/%m/%d/', validators=[challenge_app.validators.validate_file_csv])),
                ('submitted_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='challenge_app.UserStudent')),
            ],
            options={
                'verbose_name': 'Fichier téléchargeable',
                'verbose_name_plural': 'Fichiers csv téléchargeables',
            },
        ),
        migrations.AddField(
            model_name='filecsv',
            name='submitted_by',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='challenge_app.UserStudent'),
        ),
        migrations.AddField(
            model_name='filecode',
            name='submitted_by',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='challenge_app.UserStudent'),
        ),
        migrations.AddField(
            model_name='challenge',
            name='reference',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='challenge_ref', to='challenge_app.FileCsv', verbose_name='Prediction de référence'),
        ),
        migrations.AddField(
            model_name='challenge',
            name='test_input',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='challenge_input_test', to='challenge_app.FileCsvOpenUpload', verbose_name='Variable explicative de test'),
        ),
        migrations.AddField(
            model_name='challenge',
            name='training_input',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='challenge_input_train', to='challenge_app.FileCsvOpenUpload', verbose_name="Variables explicatives d'apprentissage"),
        ),
        migrations.AddField(
            model_name='challenge',
            name='training_output',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='challenge_output_train', to='challenge_app.FileCsvOpenUpload', verbose_name="Variable à expliquer d'apprentissage"),
        ),
        migrations.AddConstraint(
            model_name='submissioncount',
            constraint=models.UniqueConstraint(fields=('UserStudent', 'Challenge'), name='assoc'),
        ),
        migrations.AlterOrderWithRespectTo(
            name='submission',
            order_with_respect_to='challenge',
        ),
    ]
예제 #30
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='BaseUser',
            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=30,
                                  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')),
                ('image',
                 models.ImageField(
                     default='profile_images/default_user_image.png',
                     upload_to='profile_images')),
                ('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='BigPicture',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=150)),
                ('body', models.TextField(blank=True)),
                ('kind',
                 models.IntegerField(
                     choices=[('subject', 1), ('problem',
                                               2), ('solution',
                                                    3), ('resource',
                                                         4), ('hyperlink',
                                                              5)])),
                ('creation_date', models.DateField(auto_now_add=True)),
                ('modification_date', models.DateTimeField(auto_now=True)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('hyperlink',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='references',
                                   to='api.BigPicture')),
                ('parent',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='children',
                                   to='api.BigPicture')),
                ('subject',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='family',
                                   to='api.BigPicture')),
            ],
        ),
        migrations.CreateModel(
            name='Rating',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('value', models.FloatField(default=0.0)),
                ('date', models.DateField(default=datetime.date.today)),
                ('reason', models.TextField(blank=True)),
                ('author',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('endorsment',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='endorsments',
                                   to='api.Rating')),
                ('subject',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='subjectratings',
                                   to='api.BigPicture')),
                ('target_bp',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='ratings',
                                   to='api.BigPicture')),
                ('target_rating',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='ratings',
                                   to='api.Rating')),
            ],
        ),
        migrations.AddConstraint(
            model_name='rating',
            constraint=models.UniqueConstraint(fields=('target_rating',
                                                       'author'),
                                               name='unique_rating_on_rating'),
        ),
        migrations.AddConstraint(
            model_name='rating',
            constraint=models.UniqueConstraint(fields=('target_bp', 'author'),
                                               name='unique_rating_on_bp'),
        ),
    ]