Esempio n. 1
0
class Migration(migrations.Migration):

    dependencies = [
        ('book', '0002_remove_book_status'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='book',
            name='isbn',
        ),
        migrations.AddField(
            model_name='book',
            name='quantity',
            field=models.IntegerField(default=1, validators=[book.models.is_posititve]),
        ),
        migrations.AlterField(
            model_name='book',
            name='book_name',
            field=models.CharField(max_length=20, unique=True),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('book', '0001_initial'),
    ]

    operations = [
        migrations.AlterField(
            model_name='post',
            name='create_date',
            field=models.DateTimeField(auto_now_add=True),
        ),
        migrations.AlterField(
            model_name='post',
            name='picture',
            field=models.ImageField(null=True, upload_to=book.models.user_directory_path),
        ),
        migrations.AlterField(
            model_name='post',
            name='status',
            field=models.CharField(choices=[('1', 'open'), ('2', 'closed')], default='1', max_length=1),
        ),
    ]
Esempio n. 3
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('book', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('book_id', models.AutoField(primary_key=True,
                                             serialize=False)),
                ('name', models.CharField(max_length=20)),
                ('category', models.CharField(max_length=20)),
                ('publisher', models.CharField(max_length=15)),
                ('author', models.CharField(max_length=30)),
                ('origin_price',
                 models.FloatField(
                     max_length=6,
                     validators=[book.validators.validate_not_negative_number
                                 ])),
                ('stock',
                 models.IntegerField(
                     default=0,
                     validators=[book.validators.validate_not_negative_number
                                 ])),
                ('discount',
                 models.DecimalField(
                     decimal_places=2,
                     default=1,
                     max_digits=2,
                     max_length=3,
                     validators=[book.validators.validate_discount])),
                ('sale_number',
                 models.IntegerField(
                     default=0,
                     validators=[book.validators.validate_not_negative_number
                                 ])),
                ('is_on_sale', models.BooleanField(default=True)),
                ('putaway_date', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='BookDetail',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('cover',
                 models.ImageField(default='img/cover/default.jpg',
                                   null=True,
                                   upload_to=book.models.get_book_file_path)),
                ('catalogue',
                 models.FileField(null=True,
                                  upload_to=book.models.get_book_file_path)),
                ('summary',
                 models.FileField(null=True,
                                  upload_to=book.models.get_book_file_path)),
                ('book',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='book.Book')),
            ],
        ),
    ]
Esempio n. 4
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('shop', '0001_initial'),
        ('customer', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('metafield', jsonfield.fields.JSONField(default=dict)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('category',
                 models.CharField(choices=[('room', '订房')],
                                  default='room',
                                  max_length=255)),
                ('order_number',
                 models.CharField(default=order.models.make_order_number,
                                  help_text='订单号',
                                  max_length=255)),
                ('price', models.FloatField(help_text='订单总价 单位元')),
                ('status',
                 models.CharField(choices=[('pending', '待支付'), ('paid', '已支付'),
                                           ('refunding', '退款中'),
                                           ('refund', '已退款'),
                                           ('cancel', '已取消')],
                                  default='pending',
                                  max_length=255)),
                ('full_name',
                 models.CharField(blank=True, help_text='姓名', max_length=255)),
                ('mobile',
                 models.CharField(blank=True, help_text='手机', max_length=255)),
                ('remark', models.TextField(blank=True, help_text='备注')),
                ('use_balance', models.FloatField(default=0)),
                ('use_wx', models.FloatField(default=0)),
                ('starts_at', models.DateField(blank=True, null=True)),
                ('ends_at', models.DateField(blank=True, null=True)),
                ('arrive',
                 models.CharField(blank=True, help_text='到店时间',
                                  max_length=255)),
                ('shop',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='shop.Shop')),
                ('use_coupon',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='customer.CouponCode')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='OrderRoom',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('metafield', jsonfield.fields.JSONField(default=dict)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('quantity', models.IntegerField(default=1)),
                ('order',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='book.Order')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Room',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('metafield', jsonfield.fields.JSONField(default=dict)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('name', models.CharField(blank=True, max_length=255)),
                ('description', models.TextField(blank=True)),
                ('pic', models.ImageField(upload_to='room_pic')),
                ('area',
                 models.CharField(blank=True, help_text='面积', max_length=255)),
                ('bed_type',
                 models.CharField(blank=True, help_text='床型', max_length=255)),
                ('window',
                 models.CharField(blank=True, help_text='窗户', max_length=255)),
                ('bed_width',
                 models.CharField(blank=True, help_text='床宽', max_length=255)),
                ('capacity',
                 models.CharField(blank=True, help_text='入住人数',
                                  max_length=255)),
                ('floor',
                 models.CharField(blank=True, help_text='所在楼层',
                                  max_length=255)),
                ('price', models.FloatField(default=100)),
                ('shop',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='shop.Shop')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='orderroom',
            name='room',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='book.Room'),
        ),
    ]
Esempio n. 5
0
class Migration(migrations.Migration):

    dependencies = [
        ("book", "0006_auto_20190622_2126"),
    ]

    operations = [
        migrations.CreateModel(
            name="BookStyle",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "title",
                    models.CharField(
                        default="Default",
                        help_text="The human readable title.",
                        max_length=128,
                    ),
                ),
                (
                    "slug",
                    models.SlugField(
                        default="default",
                        help_text="The base of the filenames the style occupies.",
                        max_length=20,
                        unique=True,
                    ),
                ),
                (
                    "contents",
                    models.TextField(
                        default="", help_text="The CSS style definiton."
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="BookStyleFile",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "file",
                    models.FileField(
                        help_text="A file references in the style. The filename will be replaced with the final url of the file in the style.",
                        upload_to=book.models.bookstylefile_location,
                    ),
                ),
                (
                    "filename",
                    models.CharField(
                        help_text="The original filename.", max_length=255
                    ),
                ),
                (
                    "style",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="book.BookStyle",
                    ),
                ),
            ],
            options={
                "unique_together": {("filename", "style")},
            },
        ),
        migrations.RunPython(load_fixture, reverse_code=unload_fixture),
    ]
Esempio n. 6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('users', '0005_userleaveboard'),
    ]

    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=50)),
                ('country', models.CharField(default='中国', max_length=30)),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
                ('cover',
                 models.ImageField(blank=True,
                                   upload_to=book.models.custom_path)),
                ('intro', models.CharField(max_length=100)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='author_book',
                                   to='book.Author')),
                ('city',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='city_book',
                                   to='users.City')),
                ('owner',
                 models.ForeignKey(default=2,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='user_book',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Press',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
            ],
        ),
        migrations.CreateModel(
            name='Wishbook',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=30)),
                ('author', models.CharField(max_length=30)),
                ('owner',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='user_wishlist',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Leavemessage',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content', models.CharField(max_length=200)),
                ('sendtime', models.DateTimeField(auto_now=True)),
                ('status', models.CharField(default='未读', max_length=10)),
                ('book',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='book_leavemessage',
                                   to='book.Book')),
                ('leaver',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='leaver_leavemessage',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Changerequest',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('requesttime', models.DateTimeField(auto_now=True)),
                ('message', models.CharField(max_length=30)),
                ('statusa', models.CharField(default='已申请', max_length=10)),
                ('statusb', models.CharField(default='已申请', max_length=10)),
                ('booka',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='book_asbooka',
                                   to='book.Book')),
                ('bookb',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='book_asbookb',
                                   to='book.Book')),
                ('reciver',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='user_changereciver',
                                   to=settings.AUTH_USER_MODEL)),
                ('requester',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='user_changerequest',
                                   to=settings.AUTH_USER_MODEL)),
                ('unread',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='user_unreadchangerequest',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='book',
            name='press',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='press_book',
                to='book.Press'),
        ),
        migrations.AddField(
            model_name='book',
            name='school',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='school_book',
                to='users.School'),
        ),
    ]
Esempio n. 7
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('user', '0001_initial'),
        ('store', '0001_initial'),
    ]

    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=300, null=True)),
                ('price', models.FloatField(null=True)),
                ('code', models.IntegerField(null=True, unique=True)),
                ('image',
                 models.ImageField(null=True,
                                   upload_to=book.models.rename_image)),
                ('description', models.TextField(max_length=400, null=True)),
                ('slug_book', models.SlugField(blank=True, null=True)),
                ('category',
                 models.ForeignKey(null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='store.category')),
                ('subcategory',
                 smart_selects.db_fields.ChainedForeignKey(
                     blank=True,
                     chained_field='category',
                     chained_model_field='category',
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to='store.subcategory')),
            ],
        ),
        migrations.CreateModel(
            name='DiscountForBook',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('discountrate', models.FloatField(blank=True, null=True)),
                ('discountforbook',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='book.book')),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('totalprice', models.FloatField(blank=True, null=True)),
                ('discount', models.FloatField(blank=True, null=True)),
                ('books', models.ManyToManyField(blank=True, to='book.Book')),
                ('discountbookfororder',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='book.discountforbook')),
                ('user',
                 models.ForeignKey(null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='user.myuser')),
            ],
        ),
    ]
Esempio n. 8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('app', '0001_initial'),
        ('taggit', '0002_auto_20150616_2121'),
    ]

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('code', models.CharField(max_length=10)),
                ('name', models.CharField(max_length=100)),
                ('title',
                 models.CharField(blank=True, max_length=150, null=True)),
                ('slug', models.SlugField(blank=True,
                                          max_length=150,
                                          null=True)),
                ('option',
                 models.CharField(blank=True, max_length=150, null=True)),
                ('preview', models.TextField(blank=True, null=True)),
                ('pages', models.IntegerField(default=0)),
                ('year', models.IntegerField(default=0)),
                ('price',
                 models.DecimalField(decimal_places=2,
                                     default=0,
                                     max_digits=15)),
                ('price_ebook',
                 models.DecimalField(decimal_places=2,
                                     default=0,
                                     max_digits=15)),
                ('sample',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=book.models.get_book_sample)),
                ('image',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=book.models.get_book_image)),
                ('published', models.BooleanField(default=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('category',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='app.Category')),
                ('tags',
                 taggit.managers.TaggableManager(
                     blank=True,
                     help_text='A comma-separated list of tags.',
                     through='taggit.TaggedItem',
                     to='taggit.Tag',
                     verbose_name='Tags')),
                ('teacher',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='app.Teacher')),
            ],
            options={
                'db_table': 'book',
                'verbose_name_plural': 'Book',
            },
        ),
    ]
Esempio n. 9
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=100, unique=True)),
                ('age', models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=150)),
                ('slug', models.SlugField(blank=True, unique=True)),
                ('isbn', models.CharField(max_length=140, unique=True)),
                ('pub_date', models.DateField()),
                ('no_of_actual_copy', models.IntegerField()),
                ('no_of_copy_left', models.IntegerField()),
                ('image',
                 models.ImageField(upload_to=book.models.upload_image_path)),
                ('authors', models.ManyToManyField(to='book.Author')),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=150, 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=200, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='review',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('rating', models.IntegerField()),
                ('review', models.TextField(blank=True)),
            ],
        ),
        migrations.AddField(
            model_name='book',
            name='category',
            field=models.ManyToManyField(related_name='books',
                                         to='book.Category'),
        ),
        migrations.AddField(
            model_name='book',
            name='publisher',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='book.Publisher'),
        ),
    ]
Esempio n. 10
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('taggit', '0002_auto_20150616_2121'),
        ('app', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('code', models.CharField(max_length=10)),
                ('name', models.CharField(max_length=100)),
                ('slug', models.SlugField(blank=True,
                                          max_length=250,
                                          null=True)),
                ('title',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('preview', models.TextField(blank=True, null=True)),
                ('type',
                 models.CharField(choices=[(b'B', b'Both'), (b'E', b'e-Book'),
                                           (b'P', b'Paperback')],
                                  max_length=1)),
                ('pages', models.IntegerField(default=0)),
                ('years', models.IntegerField(default=0)),
                ('qty', models.IntegerField(default=0)),
                ('price',
                 models.DecimalField(decimal_places=2,
                                     default=0,
                                     max_digits=15)),
                ('price_ebook',
                 models.DecimalField(decimal_places=2,
                                     default=0,
                                     max_digits=15)),
                ('example',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=book.models.get_book_exam_file)),
                ('image',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=book.models.get_book_file)),
                ('published', models.BooleanField(default=True)),
                ('category',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='app.Category')),
                ('tags',
                 taggit.managers.TaggableManager(
                     help_text='A comma-separated list of tags.',
                     through='taggit.TaggedItem',
                     to='taggit.Tag',
                     verbose_name='Tags')),
                ('teacher',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='app.Teacher')),
            ],
            options={
                'db_table': 'book',
                'verbose_name_plural': 'Book',
            },
        ),
        migrations.CreateModel(
            name='BookOption',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('option', models.CharField(max_length=50)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='book.Book')),
            ],
            options={
                'db_table': 'book_option',
                'verbose_name_plural': 'BookOption',
            },
        ),
        migrations.CreateModel(
            name='Register',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('phone', models.CharField(max_length=20)),
                ('email', models.EmailField(max_length=100)),
                ('reg_date', models.DateTimeField(auto_now_add=True,
                                                  null=True)),
                ('paid', models.BooleanField(default=False)),
                ('paid_date', models.DateTimeField(blank=True, null=True)),
                ('paid_via',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('delivered', models.BooleanField(default=False)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='book.Book')),
            ],
            options={
                'ordering': ['reg_date'],
                'db_table': 'book_register',
                'verbose_name_plural': 'Register',
            },
        ),
    ]
Esempio n. 11
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name="SearchFdsnStationModel",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("network_code", models.CharField(blank=True, max_length=256)),
                ("station_code", models.CharField(blank=True, max_length=256)),
                ("site_name", models.CharField(blank=True, max_length=256)),
                (
                    "network_class",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("all", "All"),
                            ("permanent", "Permanent"),
                            ("temporary", "Temporary"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                (
                    "network_access",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("all", "All"),
                            ("unrestricted", "Unrestricted"),
                            ("restricted", "Restricted"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                (
                    "station_status",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("all", "All"),
                            ("open", "Open"),
                            ("closed", "Closed"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                (
                    "station_access",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("all", "All"),
                            ("unrestricted", "Unrestricted"),
                            ("restricted", "Restricted"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                (
                    "sensor_unit",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("all", "All"),
                            ("m", "M"),
                            ("ms", "M/S"),
                            ("mss", "M/S^2"),
                            ("pa", "PA"),
                            ("c", "C"),
                            ("deg", "DEG"),
                            ("undefined", "Undefined"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                (
                    "sensor_type",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("all", "All"),
                            ("vbb", "VBB"),
                            ("bb", "BB"),
                            ("sp", "SP"),
                            ("sm", "SM"),
                            ("obs", "OBS"),
                            ("undefined", "Undefined"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                (
                    "latitude_min",
                    models.DecimalField(blank=True, decimal_places=6, max_digits=9),
                ),
                (
                    "latitude_max",
                    models.DecimalField(blank=True, decimal_places=6, max_digits=9),
                ),
                (
                    "longitude_min",
                    models.DecimalField(blank=True, decimal_places=6, max_digits=9),
                ),
                (
                    "longitude_max",
                    models.DecimalField(blank=True, decimal_places=6, max_digits=9),
                ),
                ("start_year_from", models.IntegerField(blank=True)),
                ("start_year_to", models.IntegerField(blank=True)),
                ("end_year_from", models.IntegerField(blank=True)),
                ("end_year_to", models.IntegerField(blank=True)),
                (
                    "geological_unit",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("unknown", "Unknown"),
                            ("alluvial_deposits", "Alluvial deposits"),
                            ("ancient_alluvialterraces", "Ancient alluvial terraces"),
                            ("argillite", "Argillite"),
                            ("breccias", "Breccias"),
                            ("clay", "Clay"),
                            ("conglomerate", "Conglomerate"),
                            ("debris", "Debris"),
                            ("diabase", "Diabase"),
                            ("dolomite", "Dolomite"),
                            ("fillade", "Fillade"),
                            ("fluvial_deposits", "Fluvial deposits"),
                            ("gneiss", "Gneiss"),
                            ("granite", "Granite"),
                            ("jasper", "Jasper"),
                            ("lacustrine_deposits", "Lacustrine deposits"),
                            ("limestone", "Limestone"),
                            ("marls", "Marls"),
                            ("metamorphic_rock", "Metamorphic rock"),
                            ("micaschist", "Micaschist"),
                            ("morainic_deposits", "Morainic deposits"),
                            ("ophiolite", "Ophiolite"),
                            ("rhyolitic_ignimbrite", "Rhyolitic ignimbrite"),
                            ("sand_deposits", "Sand deposits"),
                            ("sandstone", "Sandstone"),
                            ("schist", "Schist"),
                            ("torbidite", "Torbidite"),
                            ("volcanic_deposits", "Volcanic deposits"),
                            ("volcanic_rocks", "Volcanic rocks"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                (
                    "morphology_class",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("unknown", "Unknown"),
                            ("t1", "T1"),
                            ("t2", "T2"),
                            ("t3", "T3"),
                            ("t4", "T4"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                (
                    "ground_type_ec8",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("unknown", "Unknown"),
                            ("a", "A"),
                            ("b", "B"),
                            ("c", "C"),
                            ("d", "D"),
                            ("e", "E"),
                            ("s1", "S1"),
                            ("s2", "S2"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                ("basin_flag", models.BooleanField(default=False)),
                (
                    "vs30_from",
                    models.DecimalField(blank=True, decimal_places=6, max_digits=12),
                ),
                (
                    "vs30_to",
                    models.DecimalField(blank=True, decimal_places=6, max_digits=12),
                ),
                (
                    "f0_from",
                    models.DecimalField(blank=True, decimal_places=6, max_digits=12),
                ),
                (
                    "f0_to",
                    models.DecimalField(blank=True, decimal_places=6, max_digits=12),
                ),
            ],
            options={"managed": False,},
        ),
        migrations.CreateModel(
            name="ExtEntityBase",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "ext_network_code",
                    models.TextField(blank=True, default="", max_length=16384),
                ),
                (
                    "ext_network_start_year",
                    models.TextField(blank=True, default="", max_length=16384),
                ),
                (
                    "ext_station_code",
                    models.TextField(blank=True, default="", max_length=16384),
                ),
                (
                    "ext_station_start_year",
                    models.TextField(blank=True, default="", max_length=16384),
                ),
                ("entity_removed", models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name="FdsnNetwork",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("code", models.CharField(max_length=256)),
                (
                    "description",
                    models.CharField(blank=True, default="", max_length=256),
                ),
                (
                    "start_date",
                    models.DateTimeField(blank=True, default="", max_length=256),
                ),
                (
                    "restricted_status",
                    models.CharField(blank=True, default="", max_length=256),
                ),
            ],
            options={"ordering": ["code"],},
        ),
        migrations.CreateModel(
            name="FdsnNode",
            fields=[
                (
                    "code",
                    models.CharField(
                        max_length=256, primary_key=True, serialize=False, unique=True
                    ),
                ),
                (
                    "description",
                    models.CharField(blank=True, default="", max_length=256),
                ),
                (
                    "url_dataselect",
                    models.CharField(blank=True, default="", max_length=1024),
                ),
                (
                    "url_station",
                    models.CharField(blank=True, default="", max_length=1024),
                ),
                (
                    "url_routing",
                    models.CharField(blank=True, default="", max_length=1024),
                ),
                (
                    "url_wfcatalog",
                    models.CharField(blank=True, default="", max_length=1024),
                ),
            ],
        ),
        migrations.CreateModel(
            name="FdsnStation",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("code", models.CharField(max_length=256)),
                ("site_name", models.CharField(blank=True, max_length=256)),
                (
                    "latitude",
                    models.DecimalField(blank=True, decimal_places=6, max_digits=9),
                ),
                (
                    "longitude",
                    models.DecimalField(blank=True, decimal_places=6, max_digits=9),
                ),
                (
                    "elevation",
                    models.DecimalField(blank=True, decimal_places=2, max_digits=6),
                ),
                ("restricted_status", models.CharField(blank=True, max_length=256)),
                ("start_date", models.DateTimeField(blank=True, max_length=256)),
                (
                    "end_date",
                    models.DateTimeField(blank=True, max_length=256, null=True),
                ),
                (
                    "creation_date",
                    models.DateTimeField(blank=True, max_length=256, null=True),
                ),
                (
                    "fdsn_network",
                    models.ForeignKey(
                        default=None,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="fdsn_stations",
                        to="book.FdsnNetwork",
                    ),
                ),
            ],
            options={
                "ordering": [
                    "fdsn_network__fdsn_node__code",
                    "fdsn_network__code",
                    "code",
                ],
            },
        ),
        migrations.CreateModel(
            name="Link",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("url", models.CharField(blank=True, max_length=1024, null=True)),
                ("category", models.CharField(blank=True, max_length=1024, null=True)),
                (
                    "description",
                    models.CharField(blank=True, max_length=1024, null=True),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Profile",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("about", models.CharField(blank=True, max_length=1024)),
                ("location", models.CharField(blank=True, max_length=1024)),
                ("agency", models.CharField(blank=True, max_length=1024)),
                ("department", models.CharField(blank=True, max_length=1024)),
                ("telephone", models.CharField(blank=True, max_length=1024)),
                ("skype", models.CharField(blank=True, max_length=1024)),
                (
                    "fdsn_networks",
                    models.ManyToManyField(
                        blank=True, related_name="editors", to="book.FdsnNetwork"
                    ),
                ),
                (
                    "user",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="profile",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="ExtAccessData",
            fields=[
                (
                    "extentitybase_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="book.ExtEntityBase",
                    ),
                ),
                ("updated_at", models.DateTimeField(null=True)),
                (
                    "description",
                    models.CharField(blank=True, default="Change", max_length=256),
                ),
            ],
            options={"ordering": ["-updated_at"],},
            bases=("book.extentitybase",),
        ),
        migrations.CreateModel(
            name="ExtBasicData",
            fields=[
                (
                    "extentitybase_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="book.ExtEntityBase",
                    ),
                ),
                (
                    "description",
                    models.TextField(blank=True, default="", max_length=16384),
                ),
                ("start", models.DateField(blank=True, null=True)),
                ("end", models.DateField(blank=True, null=True)),
                (
                    "imported_from_fdsn",
                    models.DateTimeField(default=django.utils.timezone.now),
                ),
                (
                    "last_synced",
                    models.DateTimeField(default=django.utils.timezone.now),
                ),
            ],
            bases=("book.extentitybase",),
        ),
        migrations.CreateModel(
            name="ExtBoreholeData",
            fields=[
                (
                    "extentitybase_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="book.ExtEntityBase",
                    ),
                ),
                ("depth", models.IntegerField(default=0)),
            ],
            bases=("book.extentitybase",),
        ),
        migrations.CreateModel(
            name="ExtBoreholeLayerData",
            fields=[
                (
                    "extentitybase_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="book.ExtEntityBase",
                    ),
                ),
                (
                    "description",
                    models.CharField(blank=True, default="", max_length=256),
                ),
                ("depth_top", models.IntegerField(default=0)),
                ("depth_bottom", models.IntegerField(default=0)),
                (
                    "borehole_data",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="borehole_layers",
                        to="book.ExtBoreholeData",
                    ),
                ),
            ],
            bases=("book.extentitybase",),
        ),
        migrations.CreateModel(
            name="ExtHousingData",
            fields=[
                (
                    "extentitybase_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="book.ExtEntityBase",
                    ),
                ),
                (
                    "description",
                    models.TextField(blank=True, default="", max_length=16384),
                ),
                (
                    "housing_class",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("borehole", "Borehole"),
                            ("bridge", "Bridge"),
                            ("building", "Building"),
                            ("cave", "Cave"),
                            ("dam", "Dam"),
                            ("free_field", "Free field"),
                            ("other_structure", "Other structure"),
                            ("tunnel", "Tunnel"),
                            ("underground_shelter", "Underground shelter"),
                            ("urban_free_field", "Urban free field"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                ("in_building", models.BooleanField(default=True)),
                ("numer_of_storeys", models.IntegerField(default=0)),
                ("distance_to_building", models.IntegerField(default=0)),
            ],
            bases=("book.extentitybase",),
        ),
        migrations.CreateModel(
            name="ExtMorphologyData",
            fields=[
                (
                    "extentitybase_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="book.ExtEntityBase",
                    ),
                ),
                (
                    "description",
                    models.TextField(blank=True, default="", max_length=16384),
                ),
                (
                    "geological_unit",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("unknown", "Unknown"),
                            ("alluvial_deposits", "Alluvial deposits"),
                            ("ancient_alluvialterraces", "Ancient alluvial terraces"),
                            ("argillite", "Argillite"),
                            ("breccias", "Breccias"),
                            ("clay", "Clay"),
                            ("conglomerate", "Conglomerate"),
                            ("debris", "Debris"),
                            ("diabase", "Diabase"),
                            ("dolomite", "Dolomite"),
                            ("fillade", "Fillade"),
                            ("fluvial_deposits", "Fluvial deposits"),
                            ("gneiss", "Gneiss"),
                            ("granite", "Granite"),
                            ("jasper", "Jasper"),
                            ("lacustrine_deposits", "Lacustrine deposits"),
                            ("limestone", "Limestone"),
                            ("marls", "Marls"),
                            ("metamorphic_rock", "Metamorphic rock"),
                            ("micaschist", "Micaschist"),
                            ("morainic_deposits", "Morainic deposits"),
                            ("ophiolite", "Ophiolite"),
                            ("rhyolitic_ignimbrite", "Rhyolitic ignimbrite"),
                            ("sand_deposits", "Sand deposits"),
                            ("sandstone", "Sandstone"),
                            ("schist", "Schist"),
                            ("torbidite", "Torbidite"),
                            ("volcanic_deposits", "Volcanic deposits"),
                            ("volcanic_rocks", "Volcanic rocks"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                (
                    "morphology_class",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("unknown", "Unknown"),
                            ("t1", "T1"),
                            ("t2", "T2"),
                            ("t3", "T3"),
                            ("t4", "T4"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                (
                    "ground_type_ec8",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("unknown", "Unknown"),
                            ("a", "A"),
                            ("b", "B"),
                            ("c", "C"),
                            ("d", "D"),
                            ("e", "E"),
                            ("s1", "S1"),
                            ("s2", "S2"),
                        ],
                        default="",
                        max_length=256,
                    ),
                ),
                ("groundwater_depth", models.IntegerField(default=0)),
                ("vs_30", models.IntegerField(default=0)),
                ("f0", models.IntegerField(default=0)),
                ("amp_f0", models.IntegerField(default=0)),
                ("basin_flag", models.BooleanField(default=False)),
                ("bedrock_depth", models.IntegerField(default=0)),
            ],
            bases=("book.extentitybase",),
        ),
        migrations.CreateModel(
            name="ExtOwnerData",
            fields=[
                (
                    "extentitybase_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="book.ExtEntityBase",
                    ),
                ),
                (
                    "name_first",
                    models.CharField(blank=True, default="n/a", max_length=256),
                ),
                (
                    "name_last",
                    models.CharField(blank=True, default="n/a", max_length=256),
                ),
                (
                    "department",
                    models.CharField(blank=True, default="n/a", max_length=256),
                ),
                ("agency", models.CharField(blank=True, default="n/a", max_length=256)),
                ("city", models.CharField(blank=True, default="n/a", max_length=256)),
                ("street", models.CharField(blank=True, default="n/a", max_length=256)),
                (
                    "country",
                    models.CharField(blank=True, default="n/a", max_length=256),
                ),
                ("phone", models.CharField(blank=True, default="n/a", max_length=256)),
                ("email", models.CharField(blank=True, default="n/a", max_length=256)),
            ],
            bases=("book.extentitybase",),
        ),
        migrations.CreateModel(
            name="Photo",
            fields=[
                (
                    "extentitybase_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="book.ExtEntityBase",
                    ),
                ),
                ("description", models.CharField(blank=True, max_length=1024)),
                (
                    "image",
                    models.ImageField(upload_to=book.models.Photo.path_file_name),
                ),
                ("uploaded_at", models.DateTimeField(auto_now_add=True)),
                (
                    "fdsn_station",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="photos",
                        to="book.FdsnStation",
                    ),
                ),
            ],
            options={"ordering": ["uploaded_at"],},
            bases=("book.extentitybase",),
        ),
        migrations.AddField(
            model_name="fdsnnetwork",
            name="fdsn_node",
            field=models.ForeignKey(
                default=None,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="fdsn_networks",
                to="book.FdsnNode",
            ),
        ),
        migrations.AddField(
            model_name="fdsnstation",
            name="ext_basic_data",
            field=models.OneToOneField(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="station",
                to="book.ExtBasicData",
            ),
        ),
        migrations.AddField(
            model_name="fdsnstation",
            name="ext_borehole_data",
            field=models.OneToOneField(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="station",
                to="book.ExtBoreholeData",
            ),
        ),
        migrations.AddField(
            model_name="fdsnstation",
            name="ext_housing_data",
            field=models.OneToOneField(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="station",
                to="book.ExtHousingData",
            ),
        ),
        migrations.AddField(
            model_name="fdsnstation",
            name="ext_morphology_data",
            field=models.OneToOneField(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="station",
                to="book.ExtMorphologyData",
            ),
        ),
        migrations.AddField(
            model_name="fdsnstation",
            name="ext_owner_data",
            field=models.OneToOneField(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="station",
                to="book.ExtOwnerData",
            ),
        ),
        migrations.AlterUniqueTogether(
            name="fdsnnetwork", unique_together={("fdsn_node", "code", "start_date")},
        ),
        migrations.AddField(
            model_name="extaccessdata",
            name="fdsn_station",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="access_data",
                to="book.FdsnStation",
            ),
        ),
        migrations.AddField(
            model_name="extaccessdata",
            name="updated_by",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="+",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterUniqueTogether(
            name="fdsnstation",
            unique_together={("fdsn_network", "code", "start_date")},
        ),
    ]
Esempio n. 12
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')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('title', models.CharField(max_length=250, verbose_name='title')),
                ('description', models.TextField(blank=True, verbose_name='description')),
                ('thumbnail', easy_thumbnails.fields.ThumbnailerImageField(blank=True, upload_to=book.models.upload_directory_path, verbose_name='thumbnail')),
                ('status', models.IntegerField(choices=[(0, 'public'), (1, 'private')], db_index=True, default=0, verbose_name='status')),
                ('license', models.IntegerField(choices=[(0, 'BY'), (1, 'BY-SA'), (2, 'BY-ND'), (3, 'BY-NC'), (4, 'BY-NC-SA'), (5, 'BY-NC-ND')], db_index=True, default=0, verbose_name='license')),
                ('view_count', models.PositiveIntegerField(default=0, verbose_name='view count')),
                ('updated', models.DateTimeField(null=True, verbose_name='updated date')),
            ],
            options={
                'verbose_name': 'book',
                'verbose_name_plural': 'books',
            },
        ),
        migrations.CreateModel(
            name='Page',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('title', models.CharField(help_text="The page title as you'd like it to be seen by the public", max_length=255, verbose_name='title')),
                ('description', models.CharField(blank=True, help_text="A short description not longer than 155 characters. Don't use double quotes.", max_length=255, verbose_name='description')),
                ('keywords', models.CharField(blank=True, help_text="A comma-separated list of keywords. Don't use double quotes.", max_length=255, verbose_name='keywords')),
                ('content', models.TextField(verbose_name='content')),
                ('status', models.IntegerField(choices=[(0, 'draft'), (1, 'public'), (2, 'private')], db_index=True, default=1, verbose_name='status')),
                ('view_count', models.PositiveIntegerField(default=0, verbose_name='view count')),
                ('ip_address', models.GenericIPAddressField(verbose_name='IP address')),
                ('updated', models.DateTimeField(null=True, verbose_name='updated date')),
                ('lft', models.PositiveIntegerField(editable=False)),
                ('rght', models.PositiveIntegerField(editable=False)),
                ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
                ('level', models.PositiveIntegerField(editable=False)),
                ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pages', to='book.Book', verbose_name='book')),
                ('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='book_page_owned', to=settings.AUTH_USER_MODEL, verbose_name='owner')),
                ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='book.Page', verbose_name='parent')),
            ],
            options={
                'verbose_name': 'page',
                'verbose_name_plural': 'pages',
            },
        ),
        migrations.CreateModel(
            name='Feedback',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('email', models.EmailField(max_length=254, verbose_name='email address')),
                ('content', models.TextField(verbose_name='content')),
                ('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='feedback', to='book.Page', verbose_name='page')),
            ],
            options={
                'verbose_name': 'feedback',
                'verbose_name_plural': 'feedback',
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('title', models.CharField(max_length=128, verbose_name='title')),
                ('slug', models.SlugField(allow_unicode=True, help_text='A short label containing only letters, numbers, underscores or hyphens for URL', max_length=255, unique=True, verbose_name='slug')),
                ('lft', models.PositiveIntegerField(editable=False)),
                ('rght', models.PositiveIntegerField(editable=False)),
                ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
                ('level', models.PositiveIntegerField(editable=False)),
                ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='book.Category', verbose_name='parent')),
            ],
            options={
                'verbose_name': 'category',
                'verbose_name_plural': 'categories',
            },
        ),
        migrations.AddField(
            model_name='book',
            name='category',
            field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='book.Category', verbose_name='category'),
        ),
        migrations.AddField(
            model_name='book',
            name='owner',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='book_book_owned', to=settings.AUTH_USER_MODEL, verbose_name='owner'),
        ),
        migrations.CreateModel(
            name='Attachment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, max_length=255, null=True, verbose_name='file name')),
                ('uid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='public identifier')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created time')),
                ('file', models.FileField(upload_to=book.models.upload_directory_path, verbose_name='uploaded file')),
                ('page', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='book.Page', verbose_name='page')),
            ],
            options={
                'verbose_name': 'attachment',
                'verbose_name_plural': 'attachments',
            },
        ),
    ]
Esempio n. 13
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Alarm',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('link_id', models.CharField(max_length=10)),
                ('category', models.CharField(default='user', max_length=32)),
                ('content', models.CharField(max_length=32)),
                ('is_new', models.BooleanField(default=True)),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.TextField(blank=True)),
                ('content', models.TextField()),
                ('date', models.DateTimeField(blank=True, default=datetime.datetime.now)),
                ('is_long', models.BooleanField(default=False)),
                ('is_short', models.BooleanField(default=False)),
                ('is_phrase', models.BooleanField(default=False)),
                ('is_spoiler', models.BooleanField(default=False)),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='articles', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('isbn', models.BigIntegerField(primary_key=True, serialize=False)),
                ('title', models.TextField()),
                ('contents', models.TextField(null=True)),
                ('author_contents', models.TextField(null=True)),
                ('url', models.TextField()),
                ('thumbnail', models.TextField()),
                ('authors', models.TextField()),
                ('publisher', models.TextField()),
                ('published_date', models.TextField(null=True)),
                ('like_users', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('content', models.TextField()),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='replies', to='book.Comment')),
            ],
            options={
                'ordering': ('date',),
            },
        ),
        migrations.CreateModel(
            name='Curation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.TextField()),
                ('content', models.TextField()),
                ('date', models.DateTimeField(blank=True, default=datetime.datetime.now)),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='curations', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Profile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nickname', models.CharField(blank=True, max_length=32)),
                ('profile_text', models.TextField(blank=True)),
                ('profile_photo', imagekit.models.fields.ProcessedImageField(default='https://react.semantic-ui.com/images/avatar/large/matthew.png', upload_to=book.models.profile_pic_path)),
                ('alarms', models.ManyToManyField(related_name='alarms', to='book.Alarm')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Library',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.TextField()),
                ('date', models.DateTimeField(blank=True, default=datetime.datetime.now)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Follow',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('followee', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='followee', to=settings.AUTH_USER_MODEL)),
                ('follower', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='follower', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='CurationLike',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('curation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='book.Curation')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='curation',
            name='like_users',
            field=models.ManyToManyField(through='book.CurationLike', to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='BookInLibrary',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='book.Book')),
                ('library', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='book.Library')),
            ],
        ),
        migrations.CreateModel(
            name='BookInCuration',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('content', models.TextField()),
                ('book', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='book.Book')),
                ('curation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='book_in_curation', to='book.Curation')),
            ],
        ),
        migrations.CreateModel(
            name='ArticleLike',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='book.Article')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='article',
            name='book',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='articles', to='book.Book'),
        ),
        migrations.AddField(
            model_name='article',
            name='like_users',
            field=models.ManyToManyField(through='book.ArticleLike', to=settings.AUTH_USER_MODEL),
        ),
        migrations.CreateModel(
            name='CurationComment',
            fields=[
                ('comment_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='book.Comment')),
                ('curation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='book.Curation')),
            ],
            bases=('book.comment',),
        ),
        migrations.CreateModel(
            name='ArticleComment',
            fields=[
                ('comment_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='book.Comment')),
                ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='book.Article')),
            ],
            bases=('book.comment',),
        ),
    ]
Esempio n. 14
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
            ],
        ),
        migrations.CreateModel(
            name='Hotel',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('city', models.CharField(default=None, max_length=64)),
                ('name', models.CharField(default=None, max_length=64)),
                ('address', models.CharField(default=None, max_length=64)),
                ('overview', models.CharField(default=None, max_length=64)),
                ('highlight', models.CharField(default=None, max_length=64)),
                ('room_types', models.CharField(default=None, max_length=64)),
                ('rating', models.CharField(default=None, max_length=64)),
                ('price', models.FloatField(default=book.models.random_price)),
                ('latitude', models.FloatField(default=0)),
                ('longitude', models.FloatField(default=0)),
                ('imgurls', models.CharField(default=None, max_length=64)),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('last_login',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='last login')),
                ('is_superuser',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates that this user has all permissions without explicitly assigning them.',
                     verbose_name='superuser status')),
                ('username',
                 models.CharField(
                     error_messages={
                         'unique': 'A user with that username already exists.'
                     },
                     help_text=
                     'Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
                     max_length=150,
                     unique=True,
                     validators=[
                         django.contrib.auth.validators.
                         UnicodeUsernameValidator()
                     ],
                     verbose_name='username')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='last name')),
                ('email',
                 models.EmailField(blank=True,
                                   max_length=254,
                                   verbose_name='email address')),
                ('is_staff',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether the user can log into this admin site.',
                     verbose_name='staff status')),
                ('is_active',
                 models.BooleanField(
                     default=True,
                     help_text=
                     'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
                     verbose_name='active')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('phone_contact', models.IntegerField(default=None)),
                ('address', models.CharField(default=None, max_length=64)),
                ('groups',
                 models.ManyToManyField(
                     blank=True,
                     help_text=
                     'The groups this user belongs to. A user will get all permissions granted to each of their groups.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Group',
                     verbose_name='groups')),
                ('user_permissions',
                 models.ManyToManyField(
                     blank=True,
                     help_text='Specific permissions for this user.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Permission',
                     verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
    ]
Esempio n. 15
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('pages', '__first__'),
    ]

    operations = [
        migrations.CreateModel(
            name='Asset',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('visual_artist', models.CharField(max_length=256)),
                ('animator',
                 models.CharField(blank=True, max_length=256, null=True)),
                ('composer',
                 models.CharField(blank=True, max_length=256, null=True)),
                ('locus', models.PositiveSmallIntegerField(default=0)),
                ('slug', models.SlugField(blank=True, editable=False)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('type',
                 models.CharField(choices=[('AUD', 'audio'), ('VID', 'video'),
                                           ('IMG', 'image'),
                                           ('IMA', 'image and audio'),
                                           ('TXA', 'text and audio')],
                                  max_length=3)),
                ('file',
                 models.FileField(
                     blank=True,
                     null=True,
                     upload_to=book.models.book_media_upload_handler)),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=256)),
                ('slug', models.SlugField(blank=True, editable=False)),
                ('cover',
                 models.ImageField(
                     default='default_cover.jpg',
                     upload_to=book.models.cover_media_upload_handler)),
                ('author', models.CharField(max_length=256)),
                ('publisher', models.CharField(max_length=256)),
                ('pub_date',
                 models.CharField(blank=True, max_length=64, null=True)),
                ('copyright',
                 models.CharField(blank=True, max_length=64, null=True)),
                ('isbn', models.CharField(blank=True, max_length=17,
                                          null=True)),
                ('reading_level',
                 models.CharField(blank=True, max_length=32, null=True)),
                ('word_count',
                 models.CharField(blank=True, max_length=5, null=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('webpage',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='books',
                                   to='pages.Page')),
            ],
        ),
        migrations.CreateModel(
            name='BookPage',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('slug', models.SlugField(blank=True, editable=False)),
                ('type',
                 models.CharField(choices=[('BPG', 'book pages'),
                                           ('GPG', 'game pages'),
                                           ('DPG', 'dashboard pages')],
                                  max_length=3)),
                ('name', models.CharField(blank=True,
                                          max_length=245,
                                          null=True)),
                ('is_title_page', models.BooleanField(default=False)),
                ('page_order',
                 models.PositiveSmallIntegerField(blank=True, null=True)),
                ('headline', models.TextField()),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='pages',
                                   to='book.Book')),
            ],
        ),
        migrations.CreateModel(
            name='Line',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('order', models.PositiveSmallIntegerField()),
                ('audio',
                 models.FileField(
                     blank=True,
                     null=True,
                     upload_to=book.models.book_media_upload_handler)),
                ('page',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='lines',
                                   to='book.BookPage')),
            ],
        ),
        migrations.CreateModel(
            name='Word',
            fields=[
                ('asset_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='book.Asset')),
                ('text', models.CharField(blank=True,
                                          max_length=256,
                                          null=True)),
                ('audio',
                 models.FileField(
                     blank=True,
                     null=True,
                     upload_to=book.models.book_media_upload_handler)),
                ('length', models.PositiveSmallIntegerField()),
                ('line',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='words',
                                   to='book.Line')),
            ],
            bases=('book.asset', ),
        ),
        migrations.AddField(
            model_name='asset',
            name='bookpage',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='assets',
                to='book.BookPage'),
        ),
    ]
Esempio n. 16
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')),
                ('name', models.CharField(max_length=40)),
                ('description', models.CharField(max_length=200)),
                ('page_num', models.IntegerField()),
                ('edition', models.IntegerField(null=True)),
                ('publisher', models.CharField(blank=True, max_length=30)),
                ('pub_year', models.IntegerField(null=True)),
                ('date_added',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date added')),
                ('category_1',
                 models.CharField(choices=[('Novel', 'Novel'),
                                           ('Mystery', 'Mystery'),
                                           ('Fantasy', 'Fantasy'),
                                           ('Psychology', 'Psychology'),
                                           ('Journal', 'Journal'),
                                           ('Poetry', 'Poetry'),
                                           ('Education', 'Education'),
                                           ('Economics', 'Economics'),
                                           ('History', 'History'),
                                           ('Law', 'Law'),
                                           ('Religious', 'Religious'),
                                           ('Life_Style', 'Life Style'),
                                           ('Science', 'Science'),
                                           ('Social_Science',
                                            'Social Science'),
                                           ('Philosophy', 'Philosophy'),
                                           ('Comic', 'Comic'),
                                           ('Children', 'Children'),
                                           ('Art', 'Art'),
                                           ('Encyclopedia', 'Encyclopedia'),
                                           ('Dictionary', 'Dictionary'),
                                           ('Biography', 'Biography'),
                                           ('Horror', 'Horror'),
                                           ('Crime', 'Crime'),
                                           ('Tragedy', 'Tragedy'),
                                           ('Fairy_Tail', 'Fairy Tail'),
                                           ('Drama', 'Drama'),
                                           ('Fable', 'Fable'),
                                           ('Humor', 'Humor'),
                                           ('Young_Adult', 'Young Adult'),
                                           ('Play', 'Play'),
                                           ('Political', 'Political'),
                                           ('Math', 'Math')],
                                  max_length=30)),
                ('category_2',
                 models.CharField(blank=True,
                                  choices=[('Novel', 'Novel'),
                                           ('Mystery', 'Mystery'),
                                           ('Fantasy', 'Fantasy'),
                                           ('Psychology', 'Psychology'),
                                           ('Journal', 'Journal'),
                                           ('Poetry', 'Poetry'),
                                           ('Education', 'Education'),
                                           ('Economics', 'Economics'),
                                           ('History', 'History'),
                                           ('Law', 'Law'),
                                           ('Religious', 'Religious'),
                                           ('Life_Style', 'Life Style'),
                                           ('Science', 'Science'),
                                           ('Social_Science',
                                            'Social Science'),
                                           ('Philosophy', 'Philosophy'),
                                           ('Comic', 'Comic'),
                                           ('Children', 'Children'),
                                           ('Art', 'Art'),
                                           ('Encyclopedia', 'Encyclopedia'),
                                           ('Dictionary', 'Dictionary'),
                                           ('Biography', 'Biography'),
                                           ('Horror', 'Horror'),
                                           ('Crime', 'Crime'),
                                           ('Tragedy', 'Tragedy'),
                                           ('Fairy_Tail', 'Fairy Tail'),
                                           ('Drama', 'Drama'),
                                           ('Fable', 'Fable'),
                                           ('Humor', 'Humor'),
                                           ('Young_Adult', 'Young Adult'),
                                           ('Play', 'Play'),
                                           ('Political', 'Political'),
                                           ('Math', 'Math')],
                                  max_length=30)),
                ('category_3',
                 models.CharField(blank=True,
                                  choices=[('Novel', 'Novel'),
                                           ('Mystery', 'Mystery'),
                                           ('Fantasy', 'Fantasy'),
                                           ('Psychology', 'Psychology'),
                                           ('Journal', 'Journal'),
                                           ('Poetry', 'Poetry'),
                                           ('Education', 'Education'),
                                           ('Economics', 'Economics'),
                                           ('History', 'History'),
                                           ('Law', 'Law'),
                                           ('Religious', 'Religious'),
                                           ('Life_Style', 'Life Style'),
                                           ('Science', 'Science'),
                                           ('Social_Science',
                                            'Social Science'),
                                           ('Philosophy', 'Philosophy'),
                                           ('Comic', 'Comic'),
                                           ('Children', 'Children'),
                                           ('Art', 'Art'),
                                           ('Encyclopedia', 'Encyclopedia'),
                                           ('Dictionary', 'Dictionary'),
                                           ('Biography', 'Biography'),
                                           ('Horror', 'Horror'),
                                           ('Crime', 'Crime'),
                                           ('Tragedy', 'Tragedy'),
                                           ('Fairy_Tail', 'Fairy Tail'),
                                           ('Drama', 'Drama'),
                                           ('Fable', 'Fable'),
                                           ('Humor', 'Humor'),
                                           ('Young_Adult', 'Young Adult'),
                                           ('Play', 'Play'),
                                           ('Political', 'Political'),
                                           ('Math', 'Math')],
                                  max_length=30)),
                ('image',
                 models.ImageField(
                     null=True,
                     unique=True,
                     upload_to=book.models.create_book_image_upload_path)),
                ('owner',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        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=30)),
                ('last_name', models.CharField(max_length=40)),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='book.Book')),
            ],
        ),
    ]
Esempio n. 17
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')),
                ('isbn10',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=10,
                                  verbose_name='ISBN10')),
                ('isbn13',
                 models.CharField(
                     max_length=13,
                     validators=[book.models.BookEditValidator.isbn13],
                     verbose_name='ISBN13')),
                ('face_l',
                 models.URLField(blank=True,
                                 default='',
                                 max_length=255,
                                 verbose_name='Face_L')),
                ('face_m',
                 models.URLField(blank=True,
                                 default='',
                                 max_length=255,
                                 verbose_name='Face_M')),
                ('face_s',
                 models.URLField(blank=True,
                                 default='',
                                 max_length=255,
                                 verbose_name='Face_S')),
                ('title', models.CharField(max_length=128,
                                           verbose_name='Title')),
                ('subtitle',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=128,
                                  verbose_name='Subtitle')),
                ('pages',
                 models.PositiveSmallIntegerField(blank=0,
                                                  default=0,
                                                  null=0,
                                                  verbose_name='Pages')),
                ('author',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=256,
                                  verbose_name='Author')),
                ('translator',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=256,
                                  verbose_name='Translator')),
                ('publisher',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=256,
                                  verbose_name='Publisher')),
                ('price',
                 models.DecimalField(blank=True,
                                     decimal_places=2,
                                     default=0,
                                     max_digits=5,
                                     null=True,
                                     verbose_name='Price')),
                ('binding',
                 models.CharField(blank=True,
                                  default='',
                                  max_length=128,
                                  verbose_name='Binding')),
                ('pubdate',
                 models.DateField(blank=True,
                                  help_text='(.etc 2017-11-13)',
                                  null=True,
                                  verbose_name='Date Published')),
                ('authorDesc',
                 models.TextField(blank=True,
                                  default='',
                                  verbose_name='Author Desc')),
                ('summary',
                 models.TextField(blank=True,
                                  default='',
                                  verbose_name='Summary')),
                ('rating',
                 models.DecimalField(blank=True,
                                     decimal_places=2,
                                     default=0,
                                     max_digits=5,
                                     null=True,
                                     verbose_name='Rating')),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=64, verbose_name='Category')),
            ],
        ),
        migrations.CreateModel(
            name='Location',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('zone',
                 models.CharField(help_text='The name of zone',
                                  max_length=128,
                                  verbose_name='Zone')),
                ('shelf',
                 models.PositiveSmallIntegerField(
                     help_text='The number of shelf', verbose_name='Shelf')),
                ('row', models.PositiveSmallIntegerField(verbose_name='Row')),
                ('col', models.PositiveSmallIntegerField(verbose_name='Col')),
            ],
        ),
        migrations.CreateModel(
            name='Reader',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('readPages',
                 models.PositiveSmallIntegerField(blank=0,
                                                  default=0,
                                                  help_text='(Pages Be Read)',
                                                  null=0,
                                                  verbose_name='Read Pages')),
                ('readStart',
                 models.DateField(blank=True,
                                  help_text='(.etc 2017-11-13)',
                                  null=True,
                                  verbose_name='Reading Start')),
                ('readEnd',
                 models.DateField(blank=True,
                                  help_text='(.etc 2017-11-13)',
                                  null=True,
                                  verbose_name='Reading Finished')),
                ('readTags',
                 models.TextField(blank=True,
                                  default='',
                                  verbose_name='Reading Tags')),
                ('readNote',
                 models.TextField(blank=True,
                                  default='',
                                  verbose_name='Reading Note')),
                ('boughtDate',
                 models.DateField(blank=True,
                                  help_text='(.etc 2017-11-13)',
                                  null=True,
                                  verbose_name='Date Bought')),
                ('boughtPrice',
                 models.DecimalField(blank=True,
                                     decimal_places=2,
                                     default=0,
                                     max_digits=5,
                                     null=True,
                                     verbose_name='Price Bought')),
                ('book',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='reader',
                                   to='book.Book',
                                   verbose_name='Book')),
                ('name',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='read',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Name of Reader')),
            ],
        ),
        migrations.AddField(
            model_name='book',
            name='category',
            field=models.ForeignKey(
                blank=True,
                default='',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='book.Category',
                verbose_name='Category'),
        ),
        migrations.AddField(
            model_name='book',
            name='location',
            field=models.ForeignKey(
                blank=True,
                default='',
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='book.Location',
                verbose_name='Location'),
        ),
    ]
Esempio n. 18
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0009_alter_user_last_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('first_name', models.CharField(max_length=30)),
                ('last_name', models.CharField(blank=True, max_length=30)),
                ('age', models.PositiveIntegerField(blank=True)),
                ('email', models.EmailField(max_length=254, unique=True)),
                ('birth_date', models.DateTimeField()),
                ('image', models.ImageField(blank=True, upload_to='')),
                ('is_staff', models.BooleanField(default=False)),
                ('is_active', models.BooleanField(default=True)),
                ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
                ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
            },
            managers=[
                ('objects', book.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=256, unique=True)),
                ('bio', models.TextField(blank=True)),
                ('date_of_birth', models.DateField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=256, unique=True)),
                ('description', models.TextField(blank=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='books', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='author',
            name='books',
            field=models.ManyToManyField(related_name='authors', to='book.Book'),
        ),
    ]
Esempio n. 19
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Content',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('stattypeus',
                 models.CharField(choices=[(1, b'IMAGE'), (2, b'CODE'),
                                           (3, b'TEXT'), (4, b'TABLE'),
                                           (5, b'POINTS'), (6, b'GRAPH'),
                                           (7, b'LINK'), (8, b'VIDEO')],
                                  default=3,
                                  max_length=20)),
                ('position', models.IntegerField()),
                ('value', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Course',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(blank=True, default='', max_length=500)),
                ('description',
                 models.CharField(blank=True, default='', max_length=500)),
                ('image',
                 models.ImageField(
                     blank=True,
                     default=None,
                     null=True,
                     upload_to=book.models.get_topic_image_path)),
            ],
        ),
        migrations.CreateModel(
            name='Topic',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(blank=True, default='', max_length=500)),
                ('description',
                 models.CharField(blank=True, default='', max_length=500)),
                ('position', models.IntegerField()),
                ('image',
                 models.ImageField(
                     blank=True,
                     default=None,
                     null=True,
                     upload_to=book.models.get_topic_image_path)),
                ('course',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='book.Course')),
            ],
        ),
        migrations.AddField(
            model_name='content',
            name='topic',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to='book.Topic'),
        ),
    ]