示例#1
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='StatisticsModel',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('time', models.DateTimeField(auto_now_add=True)),
                ('ip_address', models.GenericIPAddressField(editable=False)),
                ('http_referer',
                 models.URLField(blank=True, editable=False, null=True)),
            ],
            options={
                'verbose_name': 'unique url statistic',
                'db_table': 'short_url_statistics',
            },
        ),
        migrations.CreateModel(
            name='URLShortenerModel',
            fields=[
                ('unique_url_id',
                 models.CharField(default=backend.models.URLShortenerModel.
                                  create_unique_url_id,
                                  editable=False,
                                  max_length=8,
                                  primary_key=True,
                                  serialize=False)),
                ('expiration_datetime',
                 models.DateTimeField(default=backend.models.URLShortenerModel.
                                      generate_expiration_datetime)),
                ('original_url',
                 models.URLField(validators=[
                     django.core.validators.URLValidator(
                         schemes=['http', 'https'])
                 ])),
                ('access_limit',
                 models.PositiveSmallIntegerField(blank=True, null=True)),
                ('access_counter',
                 models.PositiveSmallIntegerField(default=0, editable=False)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'verbose_name': 'unique url',
                'db_table': 'short_urls',
            },
        ),
        migrations.AddIndex(
            model_name='urlshortenermodel',
            index=models.Index(fields=['unique_url_id'],
                               name='short_urls_unique__c8a1a1_idx'),
        ),
        migrations.AddField(
            model_name='statisticsmodel',
            name='unique_url',
            field=models.ForeignKey(
                editable=False,
                on_delete=django.db.models.deletion.CASCADE,
                to='backend.urlshortenermodel'),
        ),
        migrations.AddIndex(
            model_name='statisticsmodel',
            index=models.Index(fields=['unique_url'],
                               name='short_url_s_unique__06a083_idx'),
        ),
    ]
示例#2
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')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('email',
                 models.EmailField(max_length=254,
                                   unique=True,
                                   verbose_name='email address')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  verbose_name='last name')),
                ('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,
                     validators=[
                         django.contrib.auth.validators.
                         UnicodeUsernameValidator()
                     ],
                     verbose_name='username')),
                ('is_active',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
                     verbose_name='active')),
                ('type',
                 models.CharField(choices=[('shop', 'Магазин'),
                                           ('buyer', 'Покупатель')],
                                  default='buyer',
                                  max_length=5,
                                  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', backend.models.MyUserManager()),
            ],
        ),
        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')),
                ('dt', models.DateTimeField(auto_now_add=True)),
                ('state',
                 models.CharField(choices=[('basket', 'Статус корзины'),
                                           ('new', 'Новый'),
                                           ('confirmed', 'Подтвержден'),
                                           ('assembled', 'Собран'),
                                           ('sent', 'Отправлен'),
                                           ('delivered', 'Доставлен'),
                                           ('canceled', 'Отменен')],
                                  max_length=15,
                                  verbose_name='Статус')),
                ('contact',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='backend.Contact',
                                   verbose_name='Контакт')),
                ('user',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='orders',
                                   to=settings.AUTH_USER_MODEL,
                                   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='Название продукта')),
                ('category',
                 models.ForeignKey(blank=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')),
                ('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='category',
            name='shops',
            field=models.ManyToManyField(blank=True,
                                         related_name='categories',
                                         to='backend.Shop',
                                         verbose_name='Магазины'),
        ),
        migrations.AddConstraint(
            model_name='productparameter',
            constraint=models.UniqueConstraint(
                fields=('product_info', 'parameter'),
                name='unique_product_parameter'),
        ),
        migrations.AddConstraint(
            model_name='orderitem',
            constraint=models.UniqueConstraint(fields=('order_id',
                                                       'product_info'),
                                               name='unique_order_item'),
        ),
    ]
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')),
                ('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')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('email',
                 models.EmailField(max_length=254,
                                   unique=True,
                                   verbose_name='email address')),
                ('company',
                 models.CharField(blank=True,
                                  max_length=40,
                                  verbose_name='Компания')),
                ('position',
                 models.CharField(blank=True,
                                  max_length=40,
                                  verbose_name='Должность')),
                ('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,
                     validators=[
                         django.contrib.auth.validators.
                         UnicodeUsernameValidator()
                     ],
                     verbose_name='username')),
                ('is_active',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
                     verbose_name='active')),
                ('type',
                 models.CharField(choices=[('shop', 'Магазин'),
                                           ('buyer', 'Покупатель')],
                                  default='buyer',
                                  max_length=5,
                                  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', backend.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=32, 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=32,
                                          verbose_name='город')),
                ('street', models.CharField(max_length=64,
                                            verbose_name='улица')),
                ('house',
                 models.CharField(blank=True,
                                  max_length=16,
                                  verbose_name='дом')),
                ('building',
                 models.CharField(blank=True,
                                  max_length=16,
                                  verbose_name='строение')),
                ('apartment',
                 models.CharField(blank=True,
                                  max_length=16,
                                  verbose_name='квартира')),
                ('phone',
                 models.CharField(max_length=32, 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')),
                ('dt',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='дата создания')),
                ('state',
                 models.CharField(choices=[('basket', 'Статус корзины'),
                                           ('new', 'Новый'),
                                           ('confirmed', 'Подтвержден'),
                                           ('assembled', 'Собран'),
                                           ('sent', 'Отправлен'),
                                           ('delivered', 'Доставлен'),
                                           ('canceled', 'Отменен')],
                                  max_length=16,
                                  verbose_name='статус')),
                ('contact',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='backend.contact',
                                   verbose_name='контактные данные')),
                ('user',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='orders',
                                   to=settings.AUTH_USER_MODEL,
                                   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=32, 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=64, verbose_name='название')),
                ('category',
                 models.ForeignKey(blank=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=64,
                                  verbose_name='модель')),
                ('external_id',
                 models.PositiveIntegerField(verbose_name='внешний ID')),
                ('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=32, 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=128, 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.CreateModel(
            name='ConfirmEmailToken',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at',
                 models.DateTimeField(
                     auto_now_add=True,
                     verbose_name='Когда этот токен был создан')),
                ('key',
                 models.CharField(db_index=True,
                                  max_length=64,
                                  unique=True,
                                  verbose_name='Key')),
                ('user',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='confirm_email_tokens',
                     to=settings.AUTH_USER_MODEL,
                     verbose_name=
                     'пользователь, связанный с данным токеном смены пароля')),
            ],
            options={
                'verbose_name': 'Токен подтверждения почты',
                'verbose_name_plural': 'Токены подтверждения почты',
            },
        ),
        migrations.AddField(
            model_name='category',
            name='shops',
            field=models.ManyToManyField(blank=True,
                                         related_name='categories',
                                         to='backend.Shop',
                                         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'),
        ),
    ]
示例#4
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')),
                ('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')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')),
                ('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, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('type', models.CharField(choices=[('shop', 'Магазин'), ('buyer', 'Покупатель')], default='buyer', max_length=5, 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', backend.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=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')),
                ('status', models.CharField(choices=[('basket', 'В корзине'), ('new', 'Новый'), ('confirmed', 'Подтвержден'), ('assembled', 'Собран'), ('sent', 'Отправлен'), ('delivered', 'Доставлен'), ('canceled', 'Отменен')], default='basket', max_length=15, verbose_name='Статус')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('contact', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='backend.Contact', verbose_name='Контакт')),
                ('user', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='orders', to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
            ],
            options={
                'verbose_name': 'Заказ',
                'verbose_name_plural': 'Список заказов',
                'ordering': ('-created',),
            },
        ),
        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='Название')),
                ('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='Рекомендуемая розничная цена')),
                ('category', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='products', to='backend.Category', verbose_name='Категория')),
            ],
            options={
                'verbose_name': 'Продукт',
                'verbose_name_plural': 'Список продуктов',
                'ordering': ('category', '-name'),
            },
        ),
        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='Cтатус получения заказов')),
                ('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='parameter', to='backend.Parameter', verbose_name='Параметр')),
                ('product', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='product_parameters', to='backend.Product', verbose_name='Информация о продукте')),
            ],
            options={
                'verbose_name': 'Параметр',
                'verbose_name_plural': 'Список параметров',
            },
        ),
        migrations.AddField(
            model_name='product',
            name='shop',
            field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='products_info', to='backend.Shop', verbose_name='Магазин'),
        ),
        migrations.CreateModel(
            name='OrderItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('product_name', models.CharField(max_length=80, verbose_name='Название товара')),
                ('external_id', models.PositiveIntegerField(verbose_name='Внешний ИД')),
                ('quantity', models.PositiveIntegerField(default=1, verbose_name='Количество')),
                ('price', models.PositiveIntegerField(default=0, verbose_name='Цена')),
                ('total_amount', models.PositiveIntegerField(default=0, verbose_name='Общая стоимость')),
                ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='backend.Category', verbose_name='Категория товара')),
                ('order', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='ordered_items', to='backend.Order', verbose_name='Заказ')),
                ('shop', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='backend.Shop', verbose_name='магазин')),
            ],
            options={
                'verbose_name': 'Заказанная позиция',
                'verbose_name_plural': 'Список заказанных позиций',
            },
        ),
        migrations.CreateModel(
            name='ConfirmEmailToken',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='When was this token generated')),
                ('key', models.CharField(db_index=True, max_length=64, unique=True, verbose_name='Key')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='confirm_email_tokens', to=settings.AUTH_USER_MODEL, verbose_name='The User which is associated to this password reset token')),
            ],
            options={
                'verbose_name': 'Токен подтверждения Email',
                'verbose_name_plural': 'Токены подтверждения Email',
            },
        ),
        migrations.AddField(
            model_name='category',
            name='shops',
            field=models.ManyToManyField(blank=True, related_name='categories', to='backend.Shop', verbose_name='Магазины'),
        ),
        migrations.AddConstraint(
            model_name='productparameter',
            constraint=models.UniqueConstraint(fields=('product', 'parameter'), name='unique_product_parameter'),
        ),
        migrations.AddConstraint(
            model_name='product',
            constraint=models.UniqueConstraint(fields=('shop', 'category', 'external_id'), name='unique_product_info'),
        ),
        migrations.AddConstraint(
            model_name='orderitem',
            constraint=models.UniqueConstraint(fields=('order_id', 'product_name'), name='unique_order_item'),
        ),
    ]
示例#5
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='ClickStatisticModel',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('time', models.DateTimeField(auto_now_add=True)),
                ('ip_address', models.GenericIPAddressField(editable=False)),
                ('http_referer',
                 models.URLField(blank=True, editable=False, null=True)),
            ],
            options={
                'verbose_name': 'short url statistic',
                'db_table': 'vilantis_short_url_click_statistics',
            },
        ),
        migrations.CreateModel(
            name='ShortURLModel',
            fields=[
                ('short_url_id',
                 models.CharField(default=backend.models.ShortURLModel.
                                  generate_short_url_id,
                                  editable=False,
                                  max_length=8,
                                  primary_key=True,
                                  serialize=False)),
                ('expiration_datetime',
                 models.DateTimeField(default=backend.models.ShortURLModel.
                                      generate_expiration_datetime)),
                ('long_url', models.URLField()),
                ('access_limit',
                 models.PositiveSmallIntegerField(default=100)),
                ('access_counter',
                 models.PositiveSmallIntegerField(default=0, editable=False)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'verbose_name': 'short url',
                'db_table': 'vilantis_short_urls',
            },
        ),
        migrations.AddIndex(
            model_name='shorturlmodel',
            index=models.Index(fields=['short_url_id'],
                               name='vilantis_sh_short_u_7e003a_idx'),
        ),
        migrations.AddField(
            model_name='clickstatisticmodel',
            name='short_url',
            field=models.ForeignKey(
                editable=False,
                on_delete=django.db.models.deletion.CASCADE,
                to='backend.shorturlmodel'),
        ),
        migrations.AddIndex(
            model_name='clickstatisticmodel',
            index=models.Index(fields=['short_url'],
                               name='vilantis_sh_short_u_86a83a_idx'),
        ),
    ]
class Migration(migrations.Migration):

    replaces = [('backend', '0035_auto_20201212_1810'),
                ('backend', '0036_auto_20201212_1826'),
                ('backend', '0037_auto_20201212_1831'),
                ('backend', '0038_auto_20201212_1831'),
                ('backend', '0039_auto_20201212_1831'),
                ('backend', '0040_auto_20201212_1840'),
                ('backend', '0041_userinformation_avatar'),
                ('backend', '0042_auto_20201212_1847'),
                ('backend', '0043_auto_20201212_2057'),
                ('backend', '0044_verifiedemail_user'),
                ('backend', '0045_remove_userinformation_emails'),
                ('backend', '0046_auto_20201212_2126'),
                ('backend', '0047_auto_20201212_2127'),
                ('backend', '0048_auto_20201212_2151'),
                ('backend', '0049_populate_emails'),
                ('backend', '0050_auto_20201212_2211'),
                ('backend', '0051_auto_20201212_2258'),
                ('backend', '0052_auto_20201212_2327'),
                ('backend', '0053_auto_20201212_2341'),
                ('backend', '0054_auto_20201212_2343'),
                ('backend', '0055_auto_20201213_0022'),
                ('backend', '0056_auto_20201213_0041'),
                ('backend', '0057_auto_20201213_0125'),
                ('backend', '0058_auto_20201213_0126'),
                ('backend', '0059_verifiableemail_domain')]

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('backend', '0034_auto_20201203_1151'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='userpreferences',
            name='description',
        ),
        migrations.CreateModel(
            name='Expertise',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(help_text='Expertise description',
                                  max_length=100)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='ExpertiseKeyword',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(help_text='Expertise keyword description',
                                  max_length=100)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='UserInformation',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.TextField(blank=True,
                                  help_text='Your position',
                                  null=True)),
                ('bio',
                 models.TextField(
                     blank=True,
                     help_text='Self-description (degree, biography, ...)',
                     null=True)),
                ('comment_anonymously',
                 models.BooleanField(
                     default=False,
                     help_text='Comment anonymously by-default')),
                ('show_online_presence',
                 models.BooleanField(
                     default=False,
                     help_text='Show my online presence on Tournesol')),
                ('birth_year',
                 models.IntegerField(
                     blank=True,
                     help_text='Year of birth',
                     null=True,
                     validators=[
                         django.core.validators.MinValueValidator(1900),
                         django.core.validators.MaxValueValidator(2100)
                     ])),
                ('gender',
                 models.CharField(blank=True,
                                  help_text='Your gender',
                                  max_length=50,
                                  null=True)),
                ('nationality',
                 models.CharField(blank=True,
                                  help_text='Your nationality',
                                  max_length=50,
                                  null=True)),
                ('race',
                 models.CharField(blank=True,
                                  help_text='Your race',
                                  max_length=50,
                                  null=True)),
                ('political_affiliation',
                 models.CharField(blank=True,
                                  help_text='Your political affiliation',
                                  max_length=50,
                                  null=True)),
                ('religion',
                 models.CharField(blank=True,
                                  help_text='Your religion',
                                  max_length=50,
                                  null=True)),
                ('degree_of_political_engagement',
                 models.CharField(
                     blank=True,
                     help_text='Your degree of political engagement',
                     max_length=50,
                     null=True)),
                ('user',
                 models.OneToOneField(
                     help_text='DjangoUser that the info belong to',
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
                ('expertises',
                 models.ManyToManyField(blank=True,
                                        help_text='Your expertise.',
                                        related_name='expertises',
                                        to='backend.Expertise')),
                ('expertise_keywords',
                 models.ManyToManyField(blank=True,
                                        help_text='Your expertise keywords.',
                                        related_name='expertise_keywords',
                                        to='backend.ExpertiseKeyword')),
                ('first_name',
                 models.CharField(blank=True,
                                  help_text='First name',
                                  max_length=100,
                                  null=True)),
                ('google_scholar',
                 models.URLField(blank=True,
                                 help_text='Your Google Scholar URL',
                                 max_length=500,
                                 null=True)),
                ('last_name',
                 models.CharField(blank=True,
                                  help_text='Last name',
                                  max_length=100,
                                  null=True)),
                ('linkedin',
                 models.URLField(blank=True,
                                 help_text='Your LinkedIn URL',
                                 max_length=500,
                                 null=True)),
                ('orcid',
                 models.URLField(blank=True,
                                 help_text='Your ORCID',
                                 max_length=500,
                                 null=True)),
                ('twitter',
                 models.URLField(blank=True,
                                 help_text='Your Twitter handle',
                                 max_length=500,
                                 null=True)),
                ('website',
                 models.URLField(blank=True,
                                 help_text='Your website URL',
                                 max_length=500,
                                 null=True)),
                ('youtube',
                 models.URLField(blank=True,
                                 help_text='Your Youtube channel URL',
                                 max_length=500,
                                 null=True)),
                ('avatar',
                 models.ImageField(
                     blank=True,
                     help_text='Your profile picture.',
                     upload_to='profiles',
                     validators=[
                         backend.models.UserInformation.validate_avatar
                     ])),
            ],
        ),
        migrations.CreateModel(
            name='Degree',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('level',
                 models.CharField(help_text='Degree level', max_length=100)),
                ('domain',
                 models.CharField(help_text='Degree domain', max_length=100)),
                ('institution',
                 models.CharField(help_text='Degree institution',
                                  max_length=100)),
                ('user',
                 models.ForeignKey(
                     help_text='User that the degree belongs to.',
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to='backend.UserInformation')),
            ],
            options={
                'ordering': ['level', 'domain', 'institution'],
            },
        ),
        migrations.CreateModel(
            name='VerifiableEmail',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('email',
                 models.EmailField(help_text='E-mail address',
                                   max_length=100,
                                   unique=True)),
                ('is_verified',
                 models.BooleanField(
                     default=False,
                     help_text='If true, this e-mail is verified')),
                ('token',
                 models.CharField(
                     blank=True,
                     help_text=
                     'The token that needs to be supplied to verify this e-mail address',
                     max_length=1000,
                     null=True)),
                ('user',
                 models.ForeignKey(
                     help_text='User that this e-mail belongs to',
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to='backend.UserInformation')),
            ],
        ),
        migrations.AlterField(
            model_name='verifiableemail',
            name='user',
            field=models.ForeignKey(
                default=None,
                help_text='User that this e-mail belongs to',
                on_delete=django.db.models.deletion.CASCADE,
                to='backend.UserInformation'),
            preserve_default=False,
        ),
        migrations.AlterField(
            model_name='degree',
            name='user',
            field=models.ForeignKey(
                help_text='User that the degree belongs to.',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='degrees',
                to='backend.UserInformation'),
        ),
        migrations.AlterField(
            model_name='verifiableemail',
            name='user',
            field=models.ForeignKey(
                help_text='User that this e-mail belongs to',
                on_delete=django.db.models.deletion.CASCADE,
                related_name='emails',
                to='backend.UserInformation'),
        ),
        migrations.AlterField(
            model_name='expertise',
            name='name',
            field=models.CharField(help_text='Expertise description',
                                   max_length=100,
                                   unique=True),
        ),
        migrations.AlterField(
            model_name='expertisekeyword',
            name='name',
            field=models.CharField(help_text='Expertise keyword description',
                                   max_length=100,
                                   unique=True),
        ),
        migrations.AlterField(
            model_name='userinformation',
            name='avatar',
            field=models.ImageField(
                blank=True,
                help_text='Your profile picture.',
                null=True,
                upload_to='profiles',
                validators=[backend.models.UserInformation.validate_avatar]),
        ),
        migrations.AlterUniqueTogether(
            name='degree',
            unique_together={('level', 'domain', 'institution', 'user')},
        ),
        migrations.RemoveField(
            model_name='userinformation',
            name='expertise_keywords',
        ),
        migrations.RemoveField(
            model_name='userinformation',
            name='expertises',
        ),
        migrations.AddField(
            model_name='expertise',
            name='user',
            field=models.ForeignKey(
                help_text='User for the expertise',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='expertises',
                to='backend.UserInformation'),
        ),
        migrations.AddField(
            model_name='expertisekeyword',
            name='user',
            field=models.ForeignKey(
                help_text='User for the expertise keywords',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='expertise_keywords',
                to='backend.UserInformation'),
        ),
        migrations.AlterField(
            model_name='expertise',
            name='name',
            field=models.CharField(help_text='Expertise description',
                                   max_length=100),
        ),
        migrations.AlterField(
            model_name='expertisekeyword',
            name='name',
            field=models.CharField(help_text='Expertise keyword description',
                                   max_length=100),
        ),
        migrations.AlterUniqueTogether(
            name='expertise',
            unique_together={('name', 'user')},
        ),
        migrations.AlterUniqueTogether(
            name='expertisekeyword',
            unique_together={('name', 'user')},
        ),
        migrations.AlterModelOptions(
            name='degree',
            options={'ordering': ['rank', 'level', 'domain', 'institution']},
        ),
        migrations.AlterModelOptions(
            name='expertise',
            options={'ordering': ['rank', 'name']},
        ),
        migrations.AlterModelOptions(
            name='expertisekeyword',
            options={'ordering': ['rank', 'name']},
        ),
        migrations.AlterModelOptions(
            name='verifiableemail',
            options={'ordering': ['rank']},
        ),
        migrations.AddField(
            model_name='degree',
            name='rank',
            field=models.IntegerField(default=0, help_text='Ordering field'),
        ),
        migrations.AddField(
            model_name='expertise',
            name='rank',
            field=models.IntegerField(default=0, help_text='Ordering field'),
        ),
        migrations.AddField(
            model_name='expertisekeyword',
            name='rank',
            field=models.IntegerField(default=0, help_text='Ordering field'),
        ),
        migrations.AddField(
            model_name='verifiableemail',
            name='rank',
            field=models.IntegerField(default=0, help_text='Ordering field'),
        ),
        migrations.AlterField(
            model_name='verifiableemail',
            name='email',
            field=models.EmailField(help_text='E-mail address',
                                    max_length=100),
        ),
        migrations.AlterUniqueTogether(
            name='verifiableemail',
            unique_together={('email', 'user')},
        ),
        migrations.AlterField(
            model_name='verifiableemail',
            name='user',
            field=models.ForeignKey(
                help_text='User that this e-mail belongs to',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='emails',
                to='backend.UserInformation'),
        ),
        migrations.AddField(
            model_name='verifiableemail',
            name='domain',
            field=computed_property.fields.ComputedCharField(
                compute_from='email_domain',
                default=uuid.uuid1,
                editable=False,
                help_text='Email domain with @',
                max_length=50),
        ),
    ]
示例#7
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id',
                 models.CharField(default=backend.models.generate_uuid,
                                  editable=False,
                                  max_length=100,
                                  primary_key=True,
                                  serialize=False,
                                  unique=True)),
                ('token', models.CharField(default='1234', max_length=100)),
                ('displayName', models.CharField(max_length=100, unique=True)),
                ('github', models.URLField()),
                ('host', models.URLField()),
                ('url', models.URLField()),
                ('user',
                 models.ForeignKey(blank=True,
                                   editable=False,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.CharField(default=backend.models.generate_uuid,
                                  editable=False,
                                  max_length=100,
                                  primary_key=True,
                                  serialize=False,
                                  unique=True)),
                ('comment', models.CharField(max_length=500, null=True)),
                ('published', models.DateTimeField(auto_now_add=True)),
                ('contentType', models.CharField(max_length=50)),
                ('host', models.CharField(max_length=50)),
                ('post_author_id', models.CharField(max_length=100)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='backend.author')),
            ],
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.CharField(default=backend.models.generate_uuid,
                                  max_length=100,
                                  primary_key=True,
                                  serialize=False,
                                  unique=True)),
                ('title', models.CharField(max_length=100)),
                ('source', models.URLField()),
                ('origin', models.URLField()),
                ('description', models.CharField(max_length=100)),
                ('content_type', models.CharField(max_length=50)),
                ('content', models.CharField(max_length=500, null=True)),
                ('categories', models.JSONField()),
                ('count', models.PositiveIntegerField()),
                ('published', models.DateTimeField(auto_now_add=True)),
                ('visibility', models.CharField(max_length=20)),
                ('unlisted', models.BooleanField(default=False)),
                ('host', models.CharField(max_length=50)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='backend.author')),
            ],
        ),
        migrations.CreateModel(
            name='Like',
            fields=[
                ('id',
                 models.CharField(default=backend.models.generate_uuid,
                                  editable=False,
                                  max_length=100,
                                  primary_key=True,
                                  serialize=False,
                                  unique=True)),
                ('summary',
                 models.CharField(default='Someone Likes your post',
                                  max_length=100)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='backend.author')),
                ('comment',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='backend.comment')),
                ('post',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='backend.post')),
            ],
        ),
        migrations.AddField(
            model_name='comment',
            name='post',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='comments',
                to='backend.post'),
        ),
    ]
示例#8
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=50, verbose_name='Название')),
            ],
            options={
                'verbose_name': 'Категория',
                'verbose_name_plural': 'Категории',
            },
        ),
        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='Телефон')),
            ],
            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')),
                ('datetime', models.DateTimeField(auto_now_add=True)),
                ('status',
                 models.CharField(choices=[('basket', 'Статус корзины'),
                                           ('new', 'Новый'),
                                           ('confirmed', 'Подтвержден'),
                                           ('assembled', 'Собран'),
                                           ('sent', 'Отправлен'),
                                           ('delivered', 'Доставлен'),
                                           ('canceled', 'Отменен')],
                                  max_length=15,
                                  verbose_name='Статус')),
            ],
            options={
                'verbose_name': 'Заказ',
                'verbose_name_plural': 'Заказы',
            },
        ),
        migrations.CreateModel(
            name='Parameter',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=50, verbose_name='Название')),
            ],
            options={
                'verbose_name': 'Параметр',
                'verbose_name_plural': 'Параметры',
            },
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('category',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='products',
                                   to='backend.category',
                                   verbose_name='Категория')),
            ],
            options={
                'verbose_name': 'Продукт',
                'verbose_name_plural': 'Продукты',
            },
        ),
        migrations.CreateModel(
            name='ProductInfo',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=50, 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='Ссылка')),
                ('filename', models.CharField(max_length=100)),
            ],
            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.BooleanField(default=False)),
                ('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',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='ordered_items',
                                   to='backend.product',
                                   verbose_name='Продукт')),
                ('shop',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='ordered_items',
                                   to='backend.shop',
                                   verbose_name='Магазин')),
            ],
            options={
                'verbose_name': 'Продукт в заказе',
                'verbose_name_plural': 'Список продуктов заказа',
            },
        ),
        migrations.AddField(
            model_name='category',
            name='shop',
            field=models.ManyToManyField(blank=True,
                                         related_name='categories',
                                         to='backend.Shop',
                                         verbose_name='Магазины'),
        ),
        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=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')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('email',
                 models.EmailField(max_length=254,
                                   unique=True,
                                   verbose_name='Имэил')),
                ('company',
                 models.CharField(blank=True,
                                  max_length=100,
                                  verbose_name='Компания')),
                ('position',
                 models.CharField(blank=True,
                                  max_length=40,
                                  verbose_name='Должность')),
                ('username',
                 models.CharField(
                     default='Default_username',
                     error_messages={'unique': 'Username aleready exists'},
                     help_text=
                     'Username required. Username must be 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
                     max_length=150,
                     unique=True,
                     validators=[
                         django.contrib.auth.validators.
                         UnicodeUsernameValidator()
                     ],
                     verbose_name='имя пользователя')),
                ('is_active',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Отметьте, если пользователь должен считаться активным. Уберите эту отметку вместо удаления учётной записи.',
                     verbose_name='активный')),
                ('type',
                 models.CharField(choices=[('shop', 'Магазин'),
                                           ('buyer', 'Покупатель')],
                                  default='buyer',
                                  max_length=5,
                                  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', backend.models.UserManager()),
            ],
        ),
    ]