示例#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')),
            ],
        ),
    ]
示例#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'},
        ),
    ]
示例#3
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Movies',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('plot', models.CharField(max_length=1000)),
                ('genres',
                 djongo.models.fields.ArrayModelField(
                     model_container=catalog.models.Genre)),
                ('runtime', models.PositiveIntegerField()),
                ('cast',
                 djongo.models.fields.ArrayModelField(
                     model_container=catalog.models.Cast)),
                ('poster', models.CharField(max_length=1000, null=True)),
                ('title', models.CharField(max_length=1000)),
                ('fullplot', models.CharField(max_length=1000)),
                ('countries',
                 djongo.models.fields.ArrayModelField(
                     model_container=catalog.models.Country)),
                ('released', models.DateField()),
                ('languages',
                 djongo.models.fields.ArrayModelField(
                     model_container=catalog.models.Language)),
                ('directors',
                 djongo.models.fields.ArrayModelField(
                     model_container=catalog.models.Director)),
                ('writers',
                 djongo.models.fields.ArrayModelField(
                     model_container=catalog.models.Writers)),
                ('year', models.PositiveIntegerField()),
                ('imdb',
                 djongo.models.fields.EmbeddedModelField(
                     model_container=catalog.models.Imdb, null=True)),
                ('tomatoes',
                 djongo.models.fields.EmbeddedModelField(
                     model_container=catalog.models.Tomatoes, null=True)),
                ('Douban',
                 djongo.models.fields.EmbeddedModelField(
                     model_container=catalog.models.DouBan, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Users',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('email', models.EmailField(max_length=254, unique=True)),
                ('password', models.CharField(max_length=256)),
            ],
        ),
        migrations.CreateModel(
            name='Ratings',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date', models.DateField(auto_now_add=True)),
                ('rating',
                 models.IntegerField(
                     choices=[(0, '0'), (1,
                                         '1'), (2,
                                                '2'), (3,
                                                       '3'), (4,
                                                              '4'), (5,
                                                                     '5')])),
                ('movie_id',
                 djongo.models.fields.ArrayReferenceField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='catalog.Movies')),
                ('user_id',
                 djongo.models.fields.ArrayReferenceField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='catalog.Users')),
            ],
            options={
                'ordering': ['-date'],
            },
        ),
    ]
示例#4
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'),
        ),
    ]
示例#5
0
class Migration(migrations.Migration):

    initial = True

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

    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=100)),
            ],
            options={
                'verbose_name': 'Category',
                'verbose_name_plural': 'Categories',
            },
        ),
        migrations.CreateModel(
            name='Collection',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name': 'Collection',
                'verbose_name_plural': 'Collections',
            },
        ),
        migrations.CreateModel(
            name='FileType',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name': 'File Type',
                'verbose_name_plural': 'File Types',
            },
        ),
        migrations.CreateModel(
            name='Keyword',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name': 'Keyword',
                'verbose_name_plural': 'Keywords',
            },
        ),
        migrations.CreateModel(
            name='CatalogItem',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('accession_number',
                 models.CharField(blank=True,
                                  max_length=25,
                                  null=True,
                                  verbose_name='Accession Number')),
                ('accession_date',
                 models.DateField(auto_now_add=True,
                                  null=True,
                                  verbose_name='Accession Date')),
                ('obj_name',
                 models.CharField(blank=True,
                                  max_length=250,
                                  null=True,
                                  verbose_name='Object Date')),
                ('obj_file',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=catalog.models.catalog_files,
                                  verbose_name='Object')),
                ('description', models.TextField(blank=True, null=True)),
                ('source',
                 models.CharField(blank=True, max_length=250, null=True)),
                ('approx_obj_date',
                 models.DateField(blank=True,
                                  null=True,
                                  verbose_name='Approximate Object Date')),
                ('start_year',
                 models.PositiveIntegerField(blank=True,
                                             null=True,
                                             verbose_name='Start Year Range')),
                ('end_year',
                 models.PositiveIntegerField(blank=True,
                                             null=True,
                                             verbose_name='End Year Range')),
                ('provenance', models.TextField(blank=True, null=True)),
                ('notes', models.TextField(blank=True, null=True)),
                ('accession_img',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=catalog.models.catalog_files,
                                   verbose_name='Accession Image')),
                ('accession_img_caption',
                 models.TextField(blank=True,
                                  null=True,
                                  verbose_name='Accession Image Caption')),
                ('accession_img_description',
                 models.TextField(blank=True,
                                  null=True,
                                  verbose_name='Accession Image Description')),
                ('downloadable', models.BooleanField(default=False)),
                ('added_by',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to=settings.AUTH_USER_MODEL,
                     verbose_name='Added By')),
                ('category',
                 models.ManyToManyField(related_name='categories',
                                        to='catalog.Category')),
                ('collection',
                 models.ManyToManyField(related_name='collections',
                                        to='catalog.Collection')),
                ('file_format',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='catalog.filetype',
                     verbose_name='File Type')),
                ('keyword',
                 models.ManyToManyField(blank=True,
                                        null=True,
                                        related_name='keywords',
                                        to='catalog.Keyword')),
            ],
            options={
                'verbose_name': 'Catalog Item',
                'verbose_name_plural': 'Catalog Items',
            },
        ),
    ]
示例#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')]),
        ),
    ]
示例#7
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Addresses',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('start',
                 models.PositiveIntegerField(
                     help_text='Start of entry from file beginnings')),
                ('word_shift',
                 models.PositiveSmallIntegerField(
                     help_text=
                     'Shift to Symbol existence from entry start address')),
                ('word_len',
                 models.PositiveSmallIntegerField(
                     help_text=
                     'Length of Symbol (or his synonym) inside context')),
                ('end_shift',
                 models.PositiveSmallIntegerField(
                     help_text='Shift to end of entry from start address')),
            ],
        ),
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('first_name', models.CharField(max_length=50)),
                ('last_name', models.CharField(max_length=100)),
                ('date_of_birth', models.DateField(blank=True, null=True)),
                ('date_of_death', models.DateField(blank=True, null=True)),
            ],
            options={
                'ordering': ['last_name', 'first_name'],
            },
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('summary',
                 models.TextField(
                     help_text='Enter a brief description of the book',
                     max_length=1000)),
                ('file',
                 models.FileField(
                     help_text=
                     'Upload your text of book in one single file here',
                     storage=django.core.files.storage.FileSystemStorage(
                         location=
                         '/home/alex/code/git/Catal/WebSite/catalog/books/'),
                     upload_to='',
                     validators=[
                         django.core.validators.FileExtensionValidator(['txt'])
                     ])),
                ('isbn',
                 models.CharField(
                     help_text=
                     '13 Character <a href="https://www.isbn-international.org/content/what-isbn">ISBN number</a>',
                     max_length=13,
                     null=True,
                     verbose_name='ISBN')),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Author')),
            ],
        ),
        migrations.CreateModel(
            name='Existences',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='symbols',
                                   related_query_name='symb',
                                   to='catalog.Book')),
                ('inserter',
                 models.ForeignKey(on_delete=models.SET(
                     catalog.models.get_sentinel_user),
                                   related_name='inserted',
                                   related_query_name='ins',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Genre',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(
                     help_text=
                     'Enter a book genre (e.g. Science Fiction, French Poetry etc.)',
                     max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Language',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(
                     help_text=
                     "Enter the book's natural language (e.g. Russian, English, French etc.)",
                     max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Symbol',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
                ('occurs_in',
                 models.ManyToManyField(through='catalog.Existences',
                                        to='catalog.Book')),
            ],
        ),
        migrations.CreateModel(
            name='SymbolDescription',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('text', models.TextField(max_length=5000)),
                ('symbol',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='descriptions',
                                   to='catalog.Symbol')),
            ],
        ),
        migrations.AddField(
            model_name='existences',
            name='symbol',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='occurs',
                related_query_name='occ',
                to='catalog.Symbol'),
        ),
        migrations.AddField(
            model_name='book',
            name='genre',
            field=models.ManyToManyField(
                help_text='Select a genre for this book', to='catalog.Genre'),
        ),
        migrations.AddField(
            model_name='book',
            name='language',
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='catalog.Language'),
        ),
        migrations.AddField(
            model_name='addresses',
            name='existence',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='addressees',
                related_query_name='adr',
                to='catalog.Existences'),
        ),
    ]
示例#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')),
                ('created',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='Created')),
                ('updated',
                 models.DateTimeField(auto_now=True, verbose_name='Updated')),
                ('title',
                 models.CharField(max_length=200, verbose_name='Category')),
                ('image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=catalog.models.set_image_name,
                                   verbose_name='Изображение')),
                ('meta_description',
                 models.CharField(blank=True,
                                  max_length=200,
                                  null=True,
                                  verbose_name='META Description')),
                ('meta_keywords',
                 models.CharField(blank=True,
                                  max_length=200,
                                  null=True,
                                  verbose_name='META Keywords')),
                ('description',
                 models.TextField(blank=True,
                                  null=True,
                                  verbose_name='Description')),
                ('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',
                     verbose_name='Parent category')),
            ],
            options={
                'verbose_name': 'Category',
                'verbose_name_plural': 'Categories',
            },
            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='Created')),
                ('updated',
                 models.DateTimeField(auto_now=True, verbose_name='Updated')),
                ('title',
                 models.CharField(max_length=250, verbose_name='Product')),
                ('image',
                 models.ImageField(
                     blank=True,
                     null=True,
                     upload_to=catalog.models.set_product_image_name,
                     verbose_name='Изображение')),
                ('text',
                 models.TextField(blank=True, null=True,
                                  verbose_name='Текст')),
                ('meta_description',
                 models.CharField(blank=True,
                                  max_length=200,
                                  null=True,
                                  verbose_name='META Description')),
                ('meta_keywords',
                 models.CharField(blank=True,
                                  max_length=200,
                                  null=True,
                                  verbose_name='META Keywords')),
                ('description',
                 models.TextField(blank=True,
                                  null=True,
                                  verbose_name='Description')),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='catalog.Category',
                                   verbose_name='Category')),
            ],
            options={
                'verbose_name': 'Product',
                'verbose_name_plural': 'Products',
            },
        ),
    ]