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')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('title', models.CharField(max_length=50)),
                ('short_description', models.CharField(max_length=70)),
                ('long_description', models.TextField()),
                ('release_date', models.DateField()),
                ('price', models.PositiveIntegerField()),
                ('author', models.CharField(max_length=70)),
                ('rating', models.PositiveIntegerField(validators=[django.core.validators.MaxLengthValidator(5)])),
                ('author_image', models.ImageField(upload_to=books.models.profile_directory_path)),
                ('book_image', models.ImageField(upload_to=books.models.book_directory_path)),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
Exemple #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.upload_location)),
                ('book_name', models.CharField(max_length=100)),
                ('branch',
                 models.CharField(choices=[
                     ('Mechanical', 'Mechanical'),
                     ('Computer Science', 'Computer Science'),
                     ('Information Science', 'Information Science'),
                     ('Chemical Engineering', 'Chemical Engineering'),
                     ('Civil Engineering', 'Civil Engineering'),
                     ('Electrical Engineering', 'Electrical Engineering'),
                     ('Electronic and Communication',
                      'Electronic and Communication'),
                     ('Medical Electronics', 'Medical Electronics'),
                     ('Instrumentaion Engineering',
                      'Instrumentaion Engineering'),
                     ('Architecture', 'Architecture')
                 ],
                                  max_length=100)),
                ('sem',
                 models.PositiveIntegerField(
                     choices=[(1, 1), (3, 3), (3,
                                               3), (4,
                                                    4), (5,
                                                         5), (6,
                                                              6), (7,
                                                                   7), (8,
                                                                        8)])),
                ('price', models.PositiveIntegerField()),
                ('available', models.BooleanField(default=True)),
            ],
        ),
    ]
Exemple #3
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=64)),
                ('price', models.PositiveIntegerField()),
                ('description', models.TextField(max_length=500)),
                ('image', models.FileField(upload_to=books.models.book_directory_path)),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Publisher',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32)),
                ('address', models.CharField(max_length=128)),
                ('phone', models.CharField(max_length=32)),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20, unique=True)),
            ],
        ),
        migrations.AddField(
            model_name='book',
            name='category',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='books.Category'),
        ),
        migrations.AddField(
            model_name='book',
            name='publisher',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='books.Publisher'),
        ),
        migrations.AddField(
            model_name='book',
            name='tags',
            field=models.ManyToManyField(to='books.Tag'),
        ),
    ]
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')),
                ('title', models.CharField(max_length=100)),
                ('publisher', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=255)),
                ('ISBN', models.CharField(max_length=50)),
                ('author', models.CharField(max_length=100)),
                ('release_date',
                 models.PositiveIntegerField(
                     default=2020,
                     validators=[
                         django.core.validators.MinValueValidator(1900),
                         books.models.max_value_current_year
                     ])),
                ('price', models.IntegerField()),
                ('reviews', models.IntegerField()),
                ('cover', cloudinary.models.CloudinaryField(max_length=255)),
                ('desc', models.TextField()),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='books.category')),
                ('owner',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
class Migration(migrations.Migration):

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

    operations = [
        migrations.AddField(
            model_name='book',
            name='rating',
            field=models.DecimalField(decimal_places=2, default=0, max_digits=3, null=True),
        ),
        migrations.AddField(
            model_name='book',
            name='rating_counts',
            field=models.PositiveIntegerField(default=0, null=True),
        ),
        migrations.AlterField(
            model_name='book',
            name='category',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='books', to='books.Category', verbose_name='category'),
        ),
        migrations.AlterField(
            model_name='book',
            name='city',
            field=models.CharField(max_length=50, verbose_name='city'),
        ),
        migrations.AlterField(
            model_name='book',
            name='name',
            field=models.CharField(max_length=100, verbose_name='Title'),
        ),
        migrations.AlterField(
            model_name='book',
            name='price',
            field=models.DecimalField(decimal_places=2, max_digits=10, verbose_name='price'),
        ),
        migrations.CreateModel(
            name='BookImage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(blank=True, null=True, upload_to=books.models.user_directory_path)),
                ('thumbnail', models.ImageField(null=True, upload_to=books.models.user_directory_path2)),
                ('book', models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='books.Book')),
            ],
        ),
    ]
Exemple #6
0
class Migration(migrations.Migration):

    dependencies = [
        ('books', '0002_books'),
    ]

    operations = [
        migrations.AlterField(
            model_name='book',
            name='publication_year',
            field=models.PositiveIntegerField(
                default=2019,
                validators=[
                    django.core.validators.MinValueValidator(500),
                    books.models.max_value_current_year
                ]),
        ),
    ]
Exemple #7
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=255,
                                           verbose_name='Title')),
                ('author',
                 models.CharField(max_length=255, verbose_name='Author')),
                ('publication_year',
                 models.PositiveIntegerField(
                     default=2019,
                     validators=[
                         django.core.validators.MinValueValidator(1984),
                         books.models.max_value_current_year
                     ])),
                ('edition',
                 models.DecimalField(blank=True,
                                     decimal_places=2,
                                     max_digits=5,
                                     null=True)),
                ('image', models.CharField(max_length=255,
                                           verbose_name='Title')),
                ('quantity', models.IntegerField(default=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'),
        ),
    ]
Exemple #9
0
class Migration(migrations.Migration):

    dependencies = [
        ('books', '0004_auto_20180603_1541'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='author',
            options={
                'verbose_name': '作者',
                'verbose_name_plural': '作者'
            },
        ),
        migrations.AlterModelOptions(
            name='book',
            options={
                'verbose_name': '書籍',
                'verbose_name_plural': '書籍'
            },
        ),
        migrations.AlterModelOptions(
            name='category',
            options={
                'verbose_name': '類別',
                'verbose_name_plural': '類別'
            },
        ),
        migrations.AlterModelOptions(
            name='publisher',
            options={
                'verbose_name': '出版商',
                'verbose_name_plural': '出版商'
            },
        ),
        migrations.AlterModelOptions(
            name='tag',
            options={
                'verbose_name': '標籤',
                'verbose_name_plural': '標籤'
            },
        ),
        migrations.AlterField(
            model_name='author',
            name='name',
            field=models.CharField(max_length=32, verbose_name='名稱'),
        ),
        migrations.AlterField(
            model_name='book',
            name='authors',
            field=models.ManyToManyField(to='books.Author', verbose_name='作者'),
        ),
        migrations.AlterField(
            model_name='book',
            name='category',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='books.Category',
                verbose_name='使用者'),
        ),
        migrations.AlterField(
            model_name='book',
            name='count',
            field=models.PositiveIntegerField(default=0, verbose_name='庫存'),
        ),
        migrations.AlterField(
            model_name='book',
            name='description',
            field=models.TextField(max_length=500, verbose_name='簡介'),
        ),
        migrations.AlterField(
            model_name='book',
            name='image',
            field=models.ImageField(upload_to=books.models.book_directory_path,
                                    verbose_name='圖片'),
        ),
        migrations.AlterField(
            model_name='book',
            name='price',
            field=models.PositiveIntegerField(verbose_name='價錢'),
        ),
        migrations.AlterField(
            model_name='book',
            name='publisher',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='books.Publisher',
                verbose_name='出版商'),
        ),
        migrations.AlterField(
            model_name='book',
            name='tags',
            field=models.ManyToManyField(to='books.Tag', verbose_name='標籤'),
        ),
        migrations.AlterField(
            model_name='book',
            name='title',
            field=models.CharField(max_length=64, verbose_name='書名'),
        ),
        migrations.AlterField(
            model_name='category',
            name='name',
            field=models.CharField(max_length=32,
                                   unique=True,
                                   verbose_name='類別'),
        ),
        migrations.AlterField(
            model_name='publisher',
            name='address',
            field=models.CharField(max_length=128, verbose_name='地址'),
        ),
        migrations.AlterField(
            model_name='publisher',
            name='name',
            field=models.CharField(max_length=32, verbose_name='名稱'),
        ),
        migrations.AlterField(
            model_name='publisher',
            name='phone',
            field=models.CharField(max_length=32, verbose_name='電話'),
        ),
        migrations.AlterField(
            model_name='tag',
            name='name',
            field=models.CharField(max_length=20,
                                   unique=True,
                                   verbose_name='標籤'),
        ),
    ]