Beispiel #1
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')),
            ],
        ),
    ]
Beispiel #2
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')),
            ],
        ),
    ]
Beispiel #3
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', ),
        ),
    ]
Beispiel #4
0
class Migration(migrations.Migration):

    dependencies = [
        ('catalog', '0029_auto_20170105_0639'),
    ]

    operations = [
        migrations.AlterField(
            model_name='category',
            name='image',
            field=models.ImageField(blank=True, upload_to='img/category'),
        ),
        migrations.AlterField(
            model_name='category',
            name='slug',
            field=models.SlugField(
                help_text=
                'Unique value for product page URL, created from name.',
                max_length=255,
                unique=True),
        ),
        migrations.AlterField(
            model_name='product',
            name='image',
            field=models.ImageField(
                blank=True,
                height_field='height',
                storage=catalog.storage.OverwriteStorage(),
                upload_to=catalog.models.UploadToPathAndRename('img/items'),
                width_field='width'),
        ),
        migrations.AlterField(
            model_name='product',
            name='slug',
            field=models.SlugField(
                help_text=
                'Unique value for product page URL, created from name.',
                max_length=400,
                unique=True),
        ),
        migrations.AlterField(
            model_name='product',
            name='thumbnail',
            field=models.ImageField(
                blank=True,
                height_field='height',
                storage=catalog.storage.OverwriteStorage(),
                upload_to=catalog.models.UploadToPathAndRenameThumbnail(
                    'img/items'),
                width_field='width'),
        ),
        migrations.AlterField(
            model_name='product',
            name='unit',
            field=models.CharField(
                default='Piece',
                help_text=
                'Unit used to sell the product, e.g. 250 gm, bottle, etc.',
                max_length=100),
        ),
        migrations.AlterField(
            model_name='subcategory',
            name='slug',
            field=models.SlugField(
                help_text=
                'Unique value for product page URL, created from name.',
                max_length=255,
                unique=True),
        ),
    ]
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,
            },
        ),
    ]
Beispiel #6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('pages', '0015_add_validation_to_template'),
    ]

    operations = [
        migrations.CreateModel(
            name='AnotherRelatedEntity',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('is_active', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='MockCategory',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(db_index=True,
                                  max_length=255,
                                  verbose_name='name')),
                ('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)),
                ('page',
                 models.OneToOneField(
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='tests_mockcategory',
                     to='pages.Page')),
                ('parent',
                 mptt.fields.TreeForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='children',
                     to='tests.MockCategory',
                     verbose_name='parent')),
            ],
            options={
                'verbose_name': 'Category',
                'verbose_name_plural': 'Categories',
                'abstract': False,
            },
            bases=(models.Model, catalog.models.AdminTreeDisplayMixin),
        ),
        migrations.CreateModel(
            name='MockCategoryWithDefaultPage',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(db_index=True,
                                  max_length=255,
                                  verbose_name='name')),
                ('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)),
                ('page',
                 models.OneToOneField(
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='tests_mockcategorywithdefaultpage',
                     to='pages.Page')),
                ('parent',
                 mptt.fields.TreeForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='children',
                     to='tests.MockCategoryWithDefaultPage',
                     verbose_name='parent')),
            ],
            options={
                'verbose_name': 'Category',
                'verbose_name_plural': 'Categories',
                'abstract': False,
            },
            bases=(models.Model, catalog.models.AdminTreeDisplayMixin),
        ),
        migrations.CreateModel(
            name='MockEcommerceCategory',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(db_index=True,
                                  max_length=255,
                                  verbose_name='name')),
                ('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)),
                ('page',
                 models.OneToOneField(
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='tests_mockecommercecategory',
                     to='pages.Page')),
                ('parent',
                 mptt.fields.TreeForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='children',
                     to='tests.MockEcommerceCategory',
                     verbose_name='parent')),
            ],
            options={
                'verbose_name': 'Category',
                'verbose_name_plural': 'Categories',
                'abstract': False,
            },
            bases=(models.Model, catalog.models.AdminTreeDisplayMixin),
        ),
        migrations.CreateModel(
            name='MockEcommerceProduct',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(db_index=True,
                                  max_length=255,
                                  verbose_name='name')),
                ('price',
                 models.FloatField(blank=True,
                                   db_index=True,
                                   default=0,
                                   verbose_name='price')),
                ('in_stock',
                 models.PositiveIntegerField(db_index=True,
                                             default=0,
                                             verbose_name='in stock')),
                ('is_popular',
                 models.BooleanField(db_index=True,
                                     default=False,
                                     verbose_name='is popular')),
                ('category',
                 models.ForeignKey(null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='products',
                                   to='tests.MockEcommerceCategory')),
                ('page',
                 models.OneToOneField(
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='tests_mockecommerceproduct',
                     to='pages.Page')),
            ],
            options={
                'verbose_name': 'Product',
                'verbose_name_plural': 'Products',
                'ordering': ['name'],
                'abstract': False,
            },
            bases=(models.Model, catalog.models.AdminTreeDisplayMixin),
        ),
        migrations.CreateModel(
            name='MockEntity',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('is_active', models.BooleanField(default=True)),
                ('slug', models.SlugField(default='/so-mock-wow/')),
                ('page',
                 models.OneToOneField(
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='tests_mockentity',
                     to='pages.Page')),
                ('parent',
                 models.OneToOneField(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to='tests.MockEntity')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='MockEntityWithRelations',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('is_active', models.BooleanField(default=True)),
                ('another_related_entity',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='tests.AnotherRelatedEntity')),
            ],
        ),
        migrations.CreateModel(
            name='MockEntityWithSync',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('page',
                 models.OneToOneField(
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='tests_mockentitywithsync',
                     to='pages.Page')),
                ('parent',
                 models.OneToOneField(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to='tests.MockEntityWithSync')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='MockProduct',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(db_index=True,
                                  max_length=255,
                                  verbose_name='name')),
                ('price',
                 models.FloatField(blank=True,
                                   db_index=True,
                                   default=0,
                                   verbose_name='price')),
                ('in_stock',
                 models.PositiveIntegerField(db_index=True,
                                             default=0,
                                             verbose_name='in stock')),
                ('is_popular',
                 models.BooleanField(db_index=True,
                                     default=False,
                                     verbose_name='is popular')),
                ('category',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='products',
                                   to='tests.MockCategory')),
                ('page',
                 models.OneToOneField(
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='tests_mockproduct',
                     to='pages.Page')),
            ],
            options={
                'verbose_name': 'Product',
                'verbose_name_plural': 'Products',
                'ordering': ['name'],
                'abstract': False,
            },
            bases=(models.Model, catalog.models.AdminTreeDisplayMixin),
        ),
        migrations.CreateModel(
            name='RelatedEntity',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('is_active', models.BooleanField(default=True)),
            ],
        ),
        migrations.AddField(
            model_name='mockentitywithrelations',
            name='related_entity',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='tests.RelatedEntity'),
        ),
        migrations.AlterUniqueTogether(
            name='mockecommercecategory',
            unique_together=set([('name', 'parent')]),
        ),
        migrations.AlterUniqueTogether(
            name='mockcategorywithdefaultpage',
            unique_together=set([('name', 'parent')]),
        ),
        migrations.AlterUniqueTogether(
            name='mockcategory',
            unique_together=set([('name', 'parent')]),
        ),
    ]
Beispiel #7
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='Атрибут'),
        ),
    ]
Beispiel #8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    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=30,
                                  verbose_name='Название категории')),
                ('slug',
                 models.SlugField(max_length=30,
                                  unique=True,
                                  verbose_name='URL категории')),
                ('img',
                 models.ImageField(upload_to=catalog.models.category_img_name,
                                   verbose_name='Картинка категории')),
            ],
            options={
                'verbose_name': 'Категория',
                'verbose_name_plural': 'Категории',
            },
        ),
        migrations.CreateModel(
            name='Manufacture',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=30,
                                  verbose_name='Название компании')),
                ('slug',
                 models.SlugField(max_length=30,
                                  unique=True,
                                  verbose_name='URL производителя')),
                ('img',
                 models.ImageField(
                     help_text='500x500px',
                     upload_to=catalog.models.manufacture_img_name,
                     verbose_name='Логотип компании')),
                ('country',
                 models.CharField(max_length=60,
                                  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')),
                ('name',
                 models.CharField(max_length=50, verbose_name='Имя товара')),
                ('slug',
                 models.SlugField(blank=True,
                                  max_length=30,
                                  unique=True,
                                  verbose_name='URL товара')),
                ('date',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='Дата добовления')),
                ('price',
                 models.IntegerField(help_text='руб.', verbose_name='Цена')),
                ('warehouse',
                 models.IntegerField(
                     help_text='шт.',
                     verbose_name='Количество товара на складе')),
                ('warranty',
                 models.IntegerField(help_text='месяцев',
                                     verbose_name='Гарантия')),
                ('description', models.TextField(verbose_name='Описание')),
                ('specifications',
                 models.TextField(verbose_name='Характеристики')),
                ('set', models.TextField(verbose_name='Комплект поставки')),
                ('categories',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.category',
                                   verbose_name='Категория')),
                ('manufacture',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='catalog.manufacture',
                     verbose_name='Производитель')),
            ],
            options={
                'verbose_name': 'Товар',
                'verbose_name_plural': 'Товары',
            },
        ),
        migrations.CreateModel(
            name='ProductsImage',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('img',
                 models.ImageField(upload_to=catalog.models.product_img_name)),
                ('products',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='prodimg',
                                   to='catalog.product')),
            ],
            options={
                'verbose_name': 'Картинка товара',
                'verbose_name_plural': 'Картинки товаров',
            },
        ),
    ]
Beispiel #9
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Area',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=200,
                                          verbose_name='Nombre')),
                ('slug', models.SlugField()),
                ('description',
                 models.TextField(blank=True,
                                  null=True,
                                  verbose_name='Descripción')),
                ('image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=catalog.models.get_upload_path,
                                   verbose_name='Imagen')),
                ('active',
                 models.BooleanField(default=True, verbose_name='Activo')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=200,
                                          verbose_name='Nombre')),
                ('slug', models.SlugField()),
                ('description',
                 models.TextField(blank=True,
                                  null=True,
                                  verbose_name='Descripción')),
                ('image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=catalog.models.get_upload_path,
                                   verbose_name='Imagen')),
                ('active',
                 models.BooleanField(default=True, verbose_name='Activo')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('area',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Area')),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Service',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=200,
                                          verbose_name='Nombre')),
                ('slug', models.SlugField()),
                ('description',
                 models.TextField(blank=True,
                                  null=True,
                                  verbose_name='Descripción')),
                ('image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=catalog.models.get_upload_path,
                                   verbose_name='Imagen')),
                ('active',
                 models.BooleanField(default=True, verbose_name='Activo')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.AddField(
            model_name='area',
            name='service',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='catalog.Service'),
        ),
    ]