Exemple #1
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('create_date', models.DateField(auto_now_add=True)),
                ('text_book', models.CharField(max_length=255)),
                ('type',
                 models.CharField(choices=[('1', 'sell'), ('2', 'buy')],
                                  max_length=1)),
                ('price', models.FloatField()),
                ('picture',
                 models.ImageField(upload_to=book.models.user_directory_path)),
                ('status',
                 models.CharField(choices=[('1', 'open'), ('2', 'closed')],
                                  max_length=1)),
                ('create_by',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Exemple #2
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')),
            ],
        ),
    ]
Exemple #3
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'),
        ),
    ]
Exemple #4
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')),
            ],
        ),
    ]
Exemple #5
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()),
            ],
        ),
    ]