コード例 #1
0
ファイル: 0001_initial.py プロジェクト: GRASS-120/Book-shop
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('sites', '0002_alter_domain_unique'),
    ]

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('validated', models.BooleanField(default=False)),
                ('start_publication_on', models.DateTimeField(default=datetime.datetime.now)),
                ('end_publication_on', models.DateTimeField(blank=True, null=True)),
                ('lang', models.CharField(max_length=5)),
                ('title', models.CharField(max_length=100)),
                ('slug', models.SlugField(max_length=100, unique=True)),
                ('authors', models.CharField(max_length=200)),
                ('url', models.URLField(blank=True)),
                ('affiliate_url', models.URLField(blank=True)),
                ('isbn_10', models.CharField(blank=True, max_length=10, null=True)),
                ('isbn_13', models.CharField(blank=True, max_length=13, null=True)),
                ('asin', models.CharField(blank=True, max_length=20, null=True)),
                ('description', models.TextField()),
                ('cover', models.ImageField(blank=True, upload_to=books.models.cover_filename)),
            ],
            options={
                'verbose_name': 'Book',
                'verbose_name_plural': 'Books',
            },
            managers=[
                ('objects', django.db.models.manager.Manager()),
                ('on_site', books.models.SiteBookManager()),
            ],
        ),
        migrations.CreateModel(
            name='Editor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('slug', models.SlugField(unique=True)),
            ],
            options={
                'verbose_name': 'Editor',
                'verbose_name_plural': 'Editors',
            },
        ),
        migrations.AddField(
            model_name='book',
            name='editor',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='books.Editor'),
        ),
        migrations.AddField(
            model_name='book',
            name='site',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sites.Site'),
        ),
    ]
コード例 #2
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image',
                 models.ImageField(upload_to=books.models.generate_filename)),
                ('slug', models.SlugField()),
                ('title', models.CharField(max_length=120)),
                ('author', models.CharField(max_length=120)),
                ('about', models.TextField()),
                ('cost', models.FloatField()),
            ],
        ),
        migrations.CreateModel(
            name='Genre',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('slug', models.SlugField()),
            ],
        ),
        migrations.AddField(
            model_name='book',
            name='genre',
            field=models.ForeignKey(on_delete='', to='books.Genre'),
        ),
    ]
コード例 #3
0
class Migration(migrations.Migration):

    dependencies = [
        ('books', '0015_auto_20190518_1845'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='books',
            options={'ordering': ('title', )},
        ),
        migrations.AddField(
            model_name='books',
            name='typology',
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to='books.Type'),
        ),
        migrations.AlterField(
            model_name='books',
            name='downloads',
            field=models.IntegerField(default=0, editable=False),
        ),
        migrations.AlterField(
            model_name='books',
            name='image',
            field=models.ImageField(blank=True, upload_to='images/'),
        ),
        migrations.AlterField(
            model_name='books',
            name='pdf',
            field=models.FileField(
                upload_to=books.models.Document.path_and_rename),
        ),
        migrations.AlterField(
            model_name='books',
            name='slug',
            field=models.SlugField(max_length=255),
        ),
        migrations.AlterField(
            model_name='books',
            name='uploader',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to=settings.AUTH_USER_MODEL),
        ),
    ]
コード例 #4
0
class Migration(migrations.Migration):

    dependencies = [
        ('books', '0003_auto_20190929_2104'),
    ]

    operations = [
        migrations.AddField(
            model_name='book',
            name='slug',
            field=models.SlugField(default=1),
            preserve_default=False,
        ),
        migrations.AlterField(
            model_name='book',
            name='cover',
            field=models.ImageField(upload_to=books.models.image_folder),
        ),
    ]
コード例 #5
0
ファイル: 0001_initial.py プロジェクト: sanjarbek16/Libercen
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('slug', models.SlugField(blank=True, max_length=200, null=True)),
                ('published', models.DateField()),
                ('ISBN', models.CharField(max_length=50)),
                ('author', models.CharField(max_length=200)),
                ('genre', models.CharField(max_length=200)),
                ('about', ckeditor.fields.RichTextField()),
                ('cover', models.ImageField(null=True, upload_to=books.models.upload_to)),
                ('added_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='books_added', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Book',
                'verbose_name_plural': 'Books',
            },
        ),
        migrations.CreateModel(
            name='Favourite',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fav_to_set', to='books.Book')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fav_from_set', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-created',),
            },
        ),
    ]
コード例 #6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=60)),
                ('slug', models.CharField(max_length=80)),
            ],
            options={
                'verbose_name': 'author',
                'verbose_name_plural': 'authors',
            },
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=60)),
                ('slug', models.SlugField(max_length=80)),
                ('isbn',
                 isbn_field.fields.ISBNField(
                     max_length=28,
                     validators=[isbn_field.validators.ISBNValidator],
                     verbose_name='ISBN')),
                ('image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=books.models.upload_location)),
                ('price',
                 models.DecimalField(decimal_places=2,
                                     default=0,
                                     max_digits=10)),
                ('publish_date',
                 models.DateField(blank=True, default=datetime.date.today)),
                ('created', models.DateTimeField(auto_now=True)),
                ('updated', models.DateTimeField(auto_now_add=True)),
                ('active', models.BooleanField(default=True)),
                ('authors',
                 models.ManyToManyField(related_name='books',
                                        to='books.Author')),
            ],
            options={
                'verbose_name': 'book',
                'verbose_name_plural': 'books',
            },
        ),
        migrations.CreateModel(
            name='RequestListener',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('request_value', models.CharField(max_length=200)),
            ],
        ),
    ]
コード例 #7
0
class Migration(migrations.Migration):

    dependencies = [
        ('books', '0015_journal_month'),
    ]

    operations = [
        migrations.AlterField(
            model_name='book',
            name='age_restrictions',
            field=models.CharField(max_length=50,
                                   verbose_name='Возрастные ограничения'),
        ),
        migrations.AlterField(
            model_name='book',
            name='author',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='refers.Author',
                verbose_name='Автор'),
        ),
        migrations.AlterField(
            model_name='book',
            name='available',
            field=models.BooleanField(default=True,
                                      verbose_name='Доступно к заказу'),
        ),
        migrations.AlterField(
            model_name='book',
            name='book_ISBN',
            field=models.CharField(max_length=50, verbose_name='ISBN'),
        ),
        migrations.AlterField(
            model_name='book',
            name='book_format',
            field=models.CharField(max_length=50, verbose_name='Формат'),
        ),
        migrations.AlterField(
            model_name='book',
            name='cover',
            field=models.ImageField(upload_to=books.models.image_folder,
                                    verbose_name='Обложка'),
        ),
        migrations.AlterField(
            model_name='book',
            name='created',
            field=models.DateTimeField(auto_now_add=True,
                                       verbose_name='Дата создания'),
        ),
        migrations.AlterField(
            model_name='book',
            name='genre',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='refers.Genre',
                verbose_name='Жанр'),
        ),
        migrations.AlterField(
            model_name='book',
            name='name',
            field=models.CharField(max_length=200,
                                   verbose_name='Наименование'),
        ),
        migrations.AlterField(
            model_name='book',
            name='page',
            field=models.IntegerField(verbose_name='Количество страниц'),
        ),
        migrations.AlterField(
            model_name='book',
            name='price',
            field=models.DecimalField(decimal_places=2,
                                      max_digits=10,
                                      verbose_name='Цена, BYN'),
        ),
        migrations.AlterField(
            model_name='book',
            name='quantity_for_sale',
            field=models.IntegerField(
                verbose_name='Количество книг в наличии'),
        ),
        migrations.AlterField(
            model_name='book',
            name='rating',
            field=models.FloatField(verbose_name='Рейтинг'),
        ),
        migrations.AlterField(
            model_name='book',
            name='serie',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='refers.Serie',
                verbose_name='Серия'),
        ),
        migrations.AlterField(
            model_name='book',
            name='slug',
            field=models.SlugField(verbose_name='Slug'),
        ),
        migrations.AlterField(
            model_name='book',
            name='type_cover',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='refers.TypeCover',
                verbose_name='Переплёт'),
        ),
        migrations.AlterField(
            model_name='book',
            name='updated',
            field=models.DateTimeField(
                auto_now=True, verbose_name='Дата последнего изменения'),
        ),
        migrations.AlterField(
            model_name='book',
            name='weight_gram',
            field=models.IntegerField(verbose_name='Вес, гр'),
        ),
        migrations.AlterField(
            model_name='book',
            name='year',
            field=models.IntegerField(verbose_name='Год издания'),
        ),
        migrations.AlterField(
            model_name='journal',
            name='available',
            field=models.BooleanField(default=True,
                                      verbose_name='Доступно к заказу'),
        ),
        migrations.AlterField(
            model_name='journal',
            name='created',
            field=models.DateTimeField(auto_now_add=True,
                                       verbose_name='Дата создания'),
        ),
        migrations.AlterField(
            model_name='journal',
            name='month',
            field=models.CharField(max_length=50, verbose_name='Месяц'),
        ),
        migrations.AlterField(
            model_name='journal',
            name='name',
            field=models.CharField(max_length=200,
                                   verbose_name='Наименование'),
        ),
        migrations.AlterField(
            model_name='journal',
            name='number',
            field=models.IntegerField(verbose_name='Выпуск'),
        ),
        migrations.AlterField(
            model_name='journal',
            name='page',
            field=models.IntegerField(verbose_name='Количество страниц'),
        ),
        migrations.AlterField(
            model_name='journal',
            name='price',
            field=models.DecimalField(decimal_places=2,
                                      max_digits=10,
                                      verbose_name='Цена, BYN'),
        ),
        migrations.AlterField(
            model_name='journal',
            name='updated',
            field=models.DateTimeField(
                auto_now=True, verbose_name='Дата последнего изменения'),
        ),
        migrations.AlterField(
            model_name='journal',
            name='year',
            field=models.IntegerField(verbose_name='Год издания'),
        ),
    ]
コード例 #8
0
ファイル: 0001_initial.py プロジェクト: eduzen/filosofes
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('first_name',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('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, verbose_name='Died')),
                ('slug', models.SlugField(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',
                 ckeditor_uploader.fields.RichTextUploadingField(
                     blank=True,
                     help_text='Enter a brief description of the book',
                     null=True)),
                ('isbn',
                 models.CharField(
                     blank=True,
                     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')),
                ('cover',
                 models.ImageField(default='covers/no_cover.jpg',
                                   upload_to='covers')),
                ('slug', models.SlugField(blank=True, max_length=70,
                                          null=True)),
                ('published_data', models.DateField(blank=True, null=True)),
                ('author',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='books.Author')),
            ],
        ),
        migrations.CreateModel(
            name='BookFile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('uploaded_at', models.DateTimeField(auto_now_add=True)),
                ('file',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=books.models.get_path)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.Book')),
            ],
        ),
    ]
コード例 #9
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(blank=True, max_length=100)),
                ('description', models.TextField(blank=True)),
                ('cover_picture',
                 models.ImageField(blank=True,
                                   height_field=50,
                                   null=True,
                                   upload_to=books.models.upload_dir,
                                   width_field=30)),
                ('disabled', models.BooleanField(default=False)),
                ('slug', models.SlugField(max_length=255)),
                ('price',
                 models.CharField(blank=True, default='500.00',
                                  max_length=100)),
                ('timestamp',
                 models.DateTimeField(blank=True,
                                      default=datetime.datetime.now)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'book',
                'ordering': ('title', ),
                'verbose_name': 'Book',
                'verbose_name_plural': 'Books',
            },
        ),
        migrations.CreateModel(
            name='Contributor',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('contributors',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Contributor',
                'db_table': 'contributor',
                'verbose_name_plural': 'Contributors',
            },
        ),
        migrations.AddField(
            model_name='book',
            name='contributors',
            field=models.ManyToManyField(to='books.Contributor'),
        ),
        migrations.AlterUniqueTogether(
            name='book',
            unique_together=set([('slug', 'title')]),
        ),
    ]
コード例 #10
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        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)),
                ('slug', models.SlugField(unique=True)),
                ('autor', models.CharField(max_length=200)),
                ('description', models.TextField()),
                ('likes', models.PositiveIntegerField(default=0)),
                ('created_date',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('published_date', models.DateTimeField(blank=True,
                                                        null=True)),
                ('files',
                 models.FileField(
                     upload_to=books.models.upload_location,
                     validators=[books.models.validate_file_extension])),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='Created at')),
                ('updated_at',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='Updated at')),
                ('title',
                 models.CharField(blank=True,
                                  max_length=200,
                                  null=True,
                                  verbose_name='Title')),
            ],
            options={
                'verbose_name': 'Category',
                'verbose_name_plural': 'Categories',
            },
        ),
        migrations.AddField(
            model_name='book',
            name='book_type',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='books.Category',
                verbose_name='Category'),
        ),
    ]