Exemple #1
0
class Migration(migrations.Migration):

    dependencies = [
        ('catalog', '0003_product'),
    ]

    operations = [
        migrations.AlterField(
            model_name='category',
            name='slug',
            field=models.SlugField(blank=True),
        ),
        migrations.AlterField(
            model_name='product',
            name='image',
            field=models.ImageField(upload_to=catalog.models.image_folder),
        ),
        migrations.CreateModel(
            name='CartItem',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('qty', models.PositiveIntegerField(default=1)),
                ('item_total',
                 models.DecimalField(decimal_places=2,
                                     default=0.0,
                                     max_digits=10)),
                ('product',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Product')),
            ],
        ),
        migrations.CreateModel(
            name='Cart',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('cart_total',
                 models.DecimalField(decimal_places=2,
                                     default=0.0,
                                     max_digits=10)),
                ('items', models.ManyToManyField(to='catalog.CartItem')),
            ],
        ),
    ]
Exemple #2
0
class Migration(migrations.Migration):

    dependencies = [
        ('catalog', '0003_category'),
    ]

    operations = [
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('slug', models.CharField(max_length=255, unique=True)),
                ('base_price',
                 models.DecimalField(decimal_places=2, max_digits=10)),
                ('retail_price',
                 models.DecimalField(decimal_places=2, max_digits=10)),
                ('in_stock_count', models.PositiveIntegerField(default=1)),
                ('description', models.TextField(blank=True)),
                ('options', django.contrib.postgres.fields.jsonb.JSONField()),
            ],
        ),
        migrations.CreateModel(
            name='ProductPhoto',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('photo',
                 models.ImageField(
                     upload_to=catalog.models.get_product_image_path)),
                ('product',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='photos',
                                   to='catalog.Product')),
            ],
        ),
        migrations.AlterModelOptions(
            name='category',
            options={'verbose_name_plural': 'categories'},
        ),
    ]
Exemple #3
0
class Migration(migrations.Migration):

    dependencies = [
        ('catalog', '0004_delete_product'),
    ]

    operations = [
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=120)),
                ('slug', models.SlugField()),
                ('description', models.TextField()),
                ('image',
                 models.ImageField(
                     upload_to=catalog.models.Product.image_folder)),
                ('price', models.DecimalField(decimal_places=2, max_digits=9)),
                ('available', models.BooleanField(default=True)),
                ('brand',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='catalog.Brand')),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='catalog.Category')),
            ],
        ),
    ]
Exemple #4
0
class Migration(migrations.Migration):

    dependencies = [
        ('catalog', '0006_auto_20201103_1431'),
    ]

    operations = [
        migrations.AlterField(
            model_name='auto',
            name='consumption_per_100',
            field=models.FloatField(max_length=50,
                                    validators=[catalog.models.validate_even],
                                    verbose_name='Расход на 100 км'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='engine',
            field=models.FloatField(max_length=50,
                                    validators=[catalog.models.validate_even],
                                    verbose_name='Объём двигателя'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='number',
            field=models.CharField(max_length=50,
                                   unique=True,
                                   verbose_name='Номер'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='price_per_day',
            field=models.DecimalField(
                decimal_places=2,
                max_digits=18,
                validators=[catalog.models.validate_even],
                verbose_name='Цена в день'),
        ),
        migrations.AlterField(
            model_name='service',
            name='date_of_end',
            field=models.DateTimeField(verbose_name='Дата окончания ремонта'),
        ),
        migrations.AlterField(
            model_name='service',
            name='date_of_start',
            field=models.DateTimeField(verbose_name='Дата начала ремонта'),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('catalog', '0008_auto_20201204_0419'),
    ]

    operations = [
        migrations.AlterField(
            model_name='auto',
            name='body_type',
            field=models.CharField(choices=[('Седан', 'Седан'), ('Универсал', 'Универсал'), ('Хэтчбэк', 'Хэтчбэк'), ('Купе', 'Купе'), ('Лифтбэк', 'Лифтбэк'), ('Внедорожник', 'Внедорожник'), ('Родстер', 'Родстер')], max_length=50, verbose_name='Тип кузова'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='brand',
            field=models.CharField(choices=[('Audi', 'Audi'), ('BMW', 'BMW'), ('Chevrolet', 'Chevrolet'), ('Citroen', 'Citroen'), ('Ford', 'Ford'), ('Geely', 'Geely'), ('Honda', 'Honda'), ('Hyundai', 'Hyundai'), ('Kia', 'Kia'), ('LADA', 'LADA'), ('Land Rover', 'Land Rover'), ('Lexus', 'Lexus'), ('Mazda', 'Mazda'), ('Mercedec-Benz', 'Mercedec-Benz'), ('Mitsubishi', 'Mitsubishi'), ('Nissan', 'Nissan'), ('Opel', 'Opel'), ('Peugeot', 'Peugeot'), ('Renault', 'Renault'), ('Skoda', 'Skoda'), ('Toyota', 'Toyota'), ('Volkswagen', 'Volkswagen'), ('Volvo', 'Volvo')], max_length=50, verbose_name='Марка'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='capacity',
            field=models.CharField(max_length=5, verbose_name='Багажник (л.)'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='color',
            field=models.CharField(choices=[('Красный', 'Красный'), ('Синий', 'Синий'), ('Чёрный', 'Чёрный'), ('Зеленый', 'Зеленый'), ('Серый', 'Серый'), ('Белый', 'Белый'), ('Оранжевый', 'Оранжевый'), ('Жёлтый', 'Жёлтый'), ('Коричневый', 'Коричневый')], max_length=50, verbose_name='Цвет'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='consumption_per_100',
            field=models.FloatField(max_length=50, validators=[catalog.models.validate_even], verbose_name='Расход (на 100 км.)'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='engine',
            field=models.FloatField(max_length=50, validators=[catalog.models.validate_even], verbose_name='Объём двигателя (л.)'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='fuel',
            field=models.CharField(choices=[('Бензин', 'Бензин'), ('Дизель', 'Дизель'), ('Гибрид', 'Гибрид')], max_length=50, verbose_name='Топливо'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='number',
            field=models.CharField(max_length=5, unique=True, verbose_name='Номер'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='places',
            field=models.CharField(choices=[('2', '2'), ('4', '4'), ('5', '5'), ('7', '7')], max_length=2, verbose_name='Места'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='power',
            field=models.CharField(max_length=4, verbose_name='Мощность (л.с.)'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='price_per_day',
            field=models.DecimalField(decimal_places=2, max_digits=18, validators=[catalog.models.validate_even], verbose_name='Цена в день (Br)'),
        ),
        migrations.AlterField(
            model_name='auto',
            name='reserve',
            field=models.CharField(max_length=5, verbose_name='Запас хода (км.)'),
        ),
    ]
Exemple #6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='ShopItem',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('price',
                 models.DecimalField(decimal_places=2,
                                     default='0',
                                     max_digits=9,
                                     verbose_name='Цена')),
                ('first_image',
                 models.ImageField(null='media/no_image.png',
                                   upload_to=catalog.models.imagePath,
                                   verbose_name='Первое фото')),
                ('second_image',
                 models.ImageField(null='media/no_image.png',
                                   upload_to=catalog.models.imagePath,
                                   verbose_name='Второе фото')),
                ('title',
                 models.CharField(default='',
                                  max_length=120,
                                  verbose_name='Заголовок')),
                ('manufacter',
                 models.CharField(default='',
                                  max_length=50,
                                  verbose_name='Изготовитель')),
                ('slug',
                 models.SlugField(blank=True, editable=False, unique=True)),
                ('rating',
                 models.IntegerField(choices=[(1, '1'), (2, '2'), (3, '3'),
                                              (4, '4'), (5, '5')],
                                     default=1,
                                     verbose_name='Рейтинг')),
                ('category', models.CharField(editable=False, max_length=20)),
                ('clicks', models.IntegerField(default=0, editable=False)),
            ],
        ),
        migrations.CreateModel(
            name='Accessorie',
            fields=[
                ('shopitem_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='catalog.ShopItem')),
                ('type', models.CharField(max_length=50, verbose_name='Тип')),
                ('color', models.CharField(max_length=50,
                                           verbose_name='Цвет')),
            ],
            bases=('catalog.shopitem', ),
        ),
        migrations.CreateModel(
            name='Device',
            fields=[
                ('shopitem_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='catalog.ShopItem')),
                ('os',
                 models.CharField(default='Android',
                                  max_length=50,
                                  verbose_name='Система')),
                ('year', models.IntegerField(default=2010,
                                             verbose_name='Год')),
                ('camera', models.IntegerField(default=8,
                                               verbose_name='Камера')),
                ('display',
                 models.CharField(default='1920x1080',
                                  max_length=50,
                                  verbose_name='Разрешение')),
                ('battery',
                 models.IntegerField(default=1000, verbose_name='Батарея')),
                ('capacity',
                 models.IntegerField(default=1800,
                                     verbose_name='Вместимость')),
                ('chip',
                 models.CharField(default='MTK',
                                  max_length=50,
                                  verbose_name='Процессор')),
                ('color',
                 models.CharField(default='черный',
                                  max_length=50,
                                  verbose_name='Цвет')),
                ('has_wifi',
                 models.BooleanField(default=True,
                                     verbose_name='Есть Wi-fi?')),
                ('weight', models.IntegerField(default=400,
                                               verbose_name='Вес')),
            ],
            bases=('catalog.shopitem', ),
        ),
        migrations.CreateModel(
            name='Cable',
            fields=[
                ('accessorie_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='catalog.Accessorie')),
                ('features',
                 models.CharField(max_length=50, verbose_name='Вход')),
                ('compatibility',
                 models.CharField(max_length=50, verbose_name='Выход')),
            ],
            options={
                'verbose_name_plural': 'Кабеля',
            },
            bases=('catalog.accessorie', ),
        ),
        migrations.CreateModel(
            name='Cover',
            fields=[
                ('accessorie_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='catalog.Accessorie')),
                ('material',
                 models.CharField(max_length=50, verbose_name='Материал')),
                ('design',
                 models.CharField(max_length=50, verbose_name='Дизайн')),
            ],
            options={
                'verbose_name_plural': 'Чехлы',
            },
            bases=('catalog.accessorie', ),
        ),
        migrations.CreateModel(
            name='Headphone',
            fields=[
                ('accessorie_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='catalog.Accessorie')),
                ('communication',
                 models.CharField(max_length=50, verbose_name='Соединение')),
                ('frequency',
                 models.CharField(max_length=50,
                                  verbose_name='Максимальная частота')),
                ('connectors',
                 models.CharField(max_length=50, verbose_name='Разьем')),
            ],
            options={
                'verbose_name_plural': 'Наушники',
            },
            bases=('catalog.accessorie', ),
        ),
        migrations.CreateModel(
            name='Phone',
            fields=[
                ('device_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='catalog.Device')),
                ('access',
                 models.CharField(max_length=50, verbose_name='Доступ')),
                ('sim_format',
                 models.CharField(max_length=50,
                                  verbose_name='Поддерживаемый формат SIM')),
            ],
            options={
                'verbose_name_plural': 'Телефоны',
            },
            bases=('catalog.device', ),
        ),
        migrations.CreateModel(
            name='Sdcard',
            fields=[
                ('accessorie_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='catalog.Accessorie')),
                ('capacity', models.IntegerField(verbose_name='Вместимость')),
                ('speed', models.IntegerField(verbose_name='Скорость записи')),
            ],
            options={
                'verbose_name_plural': 'SD-карты',
            },
            bases=('catalog.accessorie', ),
        ),
        migrations.CreateModel(
            name='Tablet',
            fields=[
                ('device_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='catalog.Device')),
                ('has_pen', models.BooleanField(verbose_name='Есть стилус?')),
                ('has_keyboard',
                 models.BooleanField(verbose_name='Есть клавиатура?')),
            ],
            options={
                'verbose_name_plural': 'Планшеты',
            },
            bases=('catalog.device', ),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Market',
            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)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('type',
                 models.CharField(choices=[('sales channel', 'sales channel'),
                                           ('country', 'country')],
                                  max_length=255)),
                ('object_id', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ('-created_at', '-updated_at'),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Product',
            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)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('name', models.CharField(max_length=255)),
                ('slug', models.SlugField(unique=True)),
            ],
            options={
                'ordering': ('-created_at', '-updated_at'),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SalesChannel',
            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)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'ordering': ('-created_at', '-updated_at'),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Supplier',
            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)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('name', models.CharField(max_length=255)),
                ('default_availability',
                 models.CharField(choices=[('available', 'available'),
                                           ('unavailable', 'unavailable')],
                                  max_length=255)),
            ],
            options={
                'ordering': ('-created_at', '-updated_at'),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SupplierArticle',
            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)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('article',
                 models.CharField(max_length=255,
                                  verbose_name=catalog.models.Article)),
                ('supplier_reference_number',
                 models.CharField(max_length=255)),
                ('stock', models.IntegerField(default=0)),
                ('supplier',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Supplier')),
            ],
            options={
                'ordering': ('-created_at', '-updated_at'),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SupplierSalesChannelArticle',
            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)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('price', models.DecimalField(decimal_places=2, max_digits=9)),
                ('price_old',
                 models.DecimalField(decimal_places=2, max_digits=9)),
                ('sales_channel',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.SalesChannel')),
                ('supplier_article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.SupplierArticle')),
            ],
            options={
                'ordering': ('-created_at', '-updated_at'),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SupplierMarketAvailability',
            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)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('supplier', models.CharField(max_length=255)),
                ('availability',
                 models.CharField(choices=[('available', 'available'),
                                           ('unavailable', 'unavailable')],
                                  max_length=255)),
                ('markets', models.ManyToManyField(to='catalog.Market')),
            ],
            options={
                'ordering': ('-created_at', '-updated_at'),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Article',
            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)),
                ('deleted_at', models.DateTimeField(blank=True, null=True)),
                ('product',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Product')),
            ],
            options={
                'ordering': ('-created_at', '-updated_at'),
                'abstract': False,
            },
        ),
    ]
Exemple #8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('finance', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Дата обновления')),
                ('title', models.CharField(max_length=250)),
                ('lft', models.PositiveIntegerField(db_index=True, editable=False)),
                ('rght', models.PositiveIntegerField(db_index=True, editable=False)),
                ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
                ('level', models.PositiveIntegerField(db_index=True, editable=False)),
                ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='catalog.Category')),
            ],
            options={
                'abstract': False,
            },
            managers=[
                ('_tree_manager', django.db.models.manager.Manager()),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Дата обновления')),
                ('title', models.CharField(max_length=250)),
                ('text', models.TextField()),
                ('course', models.DecimalField(decimal_places=5, max_digits=10)),
                ('author', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
                ('currency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='finance.Currency')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ProductImage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Дата обновления')),
                ('image', models.ImageField(upload_to=catalog.models.set_product_image_name)),
                ('alt', models.CharField(blank=True, max_length=150, null=True)),
                ('is_main', models.BooleanField(default=False)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ProductVariant',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Дата обновления')),
                ('price', models.DecimalField(decimal_places=2, max_digits=12)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='catalog.Product')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='productimage',
            name='product_variant',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='catalog.ProductVariant'),
        ),
    ]
Exemple #9
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='CategoryProduct',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
            ],
        ),
        migrations.CreateModel(
            name='ImagesProduct',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image_file',
                 models.ImageField(
                     upload_to=catalog.models.product_directory_path)),
                ('priority', models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='MainCategoryProduct',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('description', models.TextField()),
                ('cost', models.DecimalField(decimal_places=2, max_digits=12)),
                ('rating', models.IntegerField()),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.CategoryProduct')),
            ],
        ),
        migrations.AddField(
            model_name='imagesproduct',
            name='product',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='catalog.Product'),
        ),
        migrations.AddField(
            model_name='categoryproduct',
            name='main_category',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='catalog.MainCategoryProduct'),
        ),
    ]
Exemple #10
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Attribute',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
            ],
            options={
                'verbose_name': 'Атрибут',
                'verbose_name_plural': 'Атрибуты',
            },
        ),
        migrations.CreateModel(
            name='Attribute_measure',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('measure',
                 models.CharField(max_length=60,
                                  unique=True,
                                  verbose_name='Значение')),
            ],
            options={
                'verbose_name': 'Единица измерения',
                'verbose_name_plural': 'Единицы измерения',
            },
        ),
        migrations.CreateModel(
            name='Attribute_title',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.CharField(max_length=60,
                                  unique=True,
                                  verbose_name='Наименование атрибута')),
            ],
            options={
                'verbose_name': 'Наименование атрибута',
                'verbose_name_plural': 'Наименование атрибутов',
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.CharField(max_length=90,
                                  unique=True,
                                  verbose_name='Название')),
                ('slug',
                 models.SlugField(max_length=90,
                                  unique=True,
                                  verbose_name='URL')),
                ('description',
                 models.TextField(max_length=1500,
                                  verbose_name='Описание категории')),
                ('svg',
                 models.CharField(max_length=30,
                                  verbose_name='Название SVG, для меню')),
                ('img',
                 models.ImageField(
                     blank=True,
                     upload_to=catalog.models.Category.category_pic,
                     verbose_name='Изображение для категории')),
                ('attr_list',
                 models.ManyToManyField(
                     blank=True,
                     to='catalog.Attribute',
                     verbose_name='Атрибуты для категории')),
                ('parent',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Category')),
            ],
            options={
                'verbose_name': 'Категория',
                'verbose_name_plural': 'Категории',
                'db_table': 'category',
            },
        ),
        migrations.CreateModel(
            name='Manufacturer',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.CharField(max_length=60,
                                  unique=True,
                                  verbose_name='Название компании')),
                ('slug', models.SlugField(unique=True, verbose_name='URL')),
                ('image',
                 models.FileField(
                     blank=True,
                     upload_to=catalog.models.Manufacturer.manufact_pic,
                     validators=[
                         django.core.validators.FileExtensionValidator(
                             ['svg', 'png', 'jpg', 'jpeg', 'webp'])
                     ],
                     verbose_name='Логотип')),
                ('description',
                 models.TextField(blank=True,
                                  max_length=1500,
                                  verbose_name='Описание')),
                ('link',
                 models.CharField(blank=True,
                                  max_length=120,
                                  verbose_name='Ссылка на сайт')),
            ],
            options={
                'verbose_name': 'Производитель',
                'verbose_name_plural': 'Производители',
                'db_table': 'manufacturer',
            },
        ),
        migrations.CreateModel(
            name='Orders',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('first_name',
                 models.CharField(max_length=120, verbose_name='Имя')),
                ('last_name',
                 models.CharField(db_index=True,
                                  max_length=120,
                                  verbose_name='Фамилия')),
                ('email',
                 models.CharField(max_length=120, verbose_name='E-mail')),
                ('address',
                 models.CharField(max_length=120, verbose_name='Адрес')),
                ('comment', models.TextField(verbose_name='Комментарий')),
                ('products', models.TextField(verbose_name='Товары')),
                ('status',
                 models.CharField(choices=[('Оформлен', 'Оформлен'),
                                           ('В обработке', 'В обработке'),
                                           ('Готов', 'Готов')],
                                  default='Оформлен',
                                  max_length=100)),
                ('total_price',
                 models.DecimalField(decimal_places=2,
                                     default=0.0,
                                     max_digits=100,
                                     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')),
                ('title',
                 models.CharField(max_length=120,
                                  unique=True,
                                  verbose_name='Наименование')),
                ('articul', models.IntegerField(verbose_name='Артикул')),
                ('slug',
                 models.SlugField(max_length=30,
                                  unique=True,
                                  verbose_name='URL')),
                ('img',
                 models.ImageField(
                     upload_to=catalog.models.Product.get_file_path,
                     verbose_name='Главная картинка')),
                ('price',
                 models.DecimalField(
                     decimal_places=2,
                     default=1.0,
                     max_digits=12,
                     validators=[
                         django.core.validators.MinValueValidator(1.0)
                     ],
                     verbose_name='Цена за 1')),
                ('s_description',
                 models.TextField(max_length=600,
                                  verbose_name='Краткое описание')),
                ('description',
                 models.TextField(max_length=2000,
                                  verbose_name='Полное описание')),
                ('add_date',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='Дата добавления')),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Category',
                                   verbose_name='Категория')),
                ('manufacturer',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Manufacturer',
                                   verbose_name='Производитель')),
            ],
            options={
                'verbose_name': 'Товар',
                'verbose_name_plural': 'Товары',
                'db_table': 'product',
            },
        ),
        migrations.CreateModel(
            name='ProductImages',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image',
                 models.ImageField(
                     upload_to=catalog.models.ProductImages.get_file_path,
                     verbose_name='Изображение')),
                ('product',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Product',
                                   verbose_name='Товар')),
            ],
            options={
                'verbose_name': 'Изображения товаров',
                'verbose_name_plural': 'Изображения товаров',
            },
        ),
        migrations.CreateModel(
            name='Attribute_list',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('value',
                 models.CharField(max_length=20, verbose_name='Значение')),
                ('attribute',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Attribute',
                                   verbose_name='Атрибут')),
                ('product',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Product',
                                   verbose_name='Товар')),
            ],
            options={
                'verbose_name': 'Пул атрибутов',
                'verbose_name_plural': 'Пул атрибутов',
            },
        ),
        migrations.AddField(
            model_name='attribute',
            name='measure',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='catalog.Attribute_measure',
                verbose_name='Ед. Измерения'),
        ),
        migrations.AddField(
            model_name='attribute',
            name='title',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='catalog.Attribute_title',
                verbose_name='Атрибут'),
        ),
    ]