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

    dependencies = [
        ('config', '0011_cartswitch'),
        ('wxapp', '0004_auto_20181116_1501'),
        ('account', '0013_wxuseraccountlog_note'),
    ]

    operations = [
        migrations.CreateModel(
            name='RechargeRecord',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('rchg_no', models.CharField(db_index=True, default=apps.account.models.generate_rg_no, max_length=128, unique=True, verbose_name='充值编号')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=19, verbose_name='充值金额')),
                ('real_pay', models.DecimalField(decimal_places=2, max_digits=19, verbose_name='支付金额')),
                ('trade_no', models.CharField(blank=True, max_length=100, null=True, unique=True, verbose_name='微信交易号')),
                ('status', models.CharField(choices=[('paid', '已支付'), ('unpaid', '未支付')], default='unpaid', max_length=128, verbose_name='充值状态')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='充值时间')),
                ('wxuser', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='recharge_records', to='wxapp.WxUser', verbose_name='用户')),
            ],
            options={
                'verbose_name': '充值记录',
                'verbose_name_plural': '充值记录',
                'ordering': ('-create_time',),
            },
        ),
        migrations.CreateModel(
            name='UserLevel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('level', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='users', to='config.Level', verbose_name='会员等级')),
                ('wxuser', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='level', to='wxapp.WxUser', verbose_name='用户')),
            ],
            options={
                'verbose_name': '用户等级',
                'verbose_name_plural': '用户等级',
            },
        ),
        migrations.AddField(
            model_name='wxuseraccount',
            name='recharge',
            field=models.DecimalField(decimal_places=2, default=0, max_digits=30, verbose_name='充值余额'),
        ),
        migrations.AddField(
            model_name='wxuseraccount',
            name='total_recharge',
            field=models.DecimalField(decimal_places=2, default=0, max_digits=30, verbose_name='累计充值实付金额'),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('wxapp', '0003_wxuser_testers'),
        ('account', '0005_auto_20180724_0947'),
    ]

    operations = [
        migrations.CreateModel(
            name='Withdraw',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('withdraw_no',
                 models.CharField(default=apps.account.models.generate_wd_no,
                                  max_length=128,
                                  unique=True,
                                  verbose_name='提现单号')),
                ('amount',
                 models.DecimalField(decimal_places=2,
                                     max_digits=19,
                                     verbose_name='提现金额')),
                ('wx_code', models.CharField(max_length=128,
                                             verbose_name='微信号')),
                ('add_time',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='提现发起时间')),
                ('succ_time',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='完成时间')),
                ('remark',
                 models.CharField(blank=True,
                                  max_length=256,
                                  null=True,
                                  verbose_name='备注')),
                ('status',
                 models.CharField(choices=[(0, '提现中'), (1, '提现失败'),
                                           (2, '提现完成')],
                                  default=0,
                                  max_length=128,
                                  verbose_name='提现状态')),
                ('wxuser',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='withdraw_logs',
                                   to='wxapp.WxUser',
                                   verbose_name='用户')),
            ],
            options={
                'verbose_name': '提现记录',
                'verbose_name_plural': '提现记录',
                'ordering': ('status', '-add_time'),
            },
        ),
        migrations.AlterField(
            model_name='wxuseraccountlog',
            name='a_type',
            field=models.CharField(choices=[('asset', '分销'), ('use', '抵现'),
                                            ('use_return', '取消订单返还'),
                                            ('withdraw', '提现'),
                                            ('fail_withdraw_return', '提现失败返还')
                                            ],
                                   max_length=32,
                                   verbose_name='类型'),
        ),
    ]
Exemple #3
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Account',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('created_at',
                 models.DateTimeField(auto_now_add=True, db_index=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('name',
                 models.CharField(db_index=True,
                                  max_length=255,
                                  verbose_name='Name')),
                ('plan',
                 models.CharField(choices=[('trial', 'Trial'), ('pro', 'Pro')],
                                  default='trial',
                                  max_length=255)),
                ('plan_end_at',
                 models.DateTimeField(default=apps.account.models.trial_time)),
                ('plan_limit', models.PositiveIntegerField(default=10)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.BigAutoField(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')),
                ('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')),
                ('role',
                 models.CharField(choices=[('admin', 'Admin'),
                                           ('member', 'Member')],
                                  default='member',
                                  max_length=255,
                                  verbose_name='Role')),
                ('name',
                 models.CharField(blank=True,
                                  max_length=255,
                                  verbose_name='Name')),
                ('account',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='account.account')),
                ('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()),
            ],
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0008_alter_user_username_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')),
                ('is_staff',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether the user can log into this admin site.',
                     verbose_name='staff status')),
                ('phone',
                 models.CharField(max_length=12,
                                  unique=True,
                                  verbose_name='Phone number or Username')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  verbose_name='First name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  verbose_name='Last name')),
                ('date_joined',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='Date joined')),
                ('is_active',
                 models.BooleanField(default=True, verbose_name='Active')),
                ('email',
                 models.EmailField(blank=True, max_length=254, null=True)),
            ],
            options={
                'verbose_name': 'User',
                'verbose_name_plural': 'Users',
            },
            managers=[
                ('objects', apps.account.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Client',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('address',
                 models.TextField(blank=True,
                                  null=True,
                                  verbose_name='Client address')),
            ],
        ),
        migrations.CreateModel(
            name='DeliveryAddress',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('address', models.TextField()),
                ('email', models.EmailField(max_length=60)),
                ('phone', models.CharField(max_length=60)),
                ('is_default', models.BooleanField(default=False)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Files',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('file',
                 models.FileField(default='default.png', upload_to='files/')),
            ],
            options={
                'verbose_name': 'File',
                'verbose_name_plural': 'Files',
            },
        ),
        migrations.CreateModel(
            name='Merchant',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('merchant_type',
                 models.IntegerField(choices=[(1, 'Producer'),
                                              (2, 'Supplier')],
                                     verbose_name='Merchant type')),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='merchant',
                     to=settings.AUTH_USER_MODEL,
                     verbose_name='Merchant user')),
            ],
        ),
        migrations.CreateModel(
            name='PaymentCards',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('card_holder',
                 models.CharField(max_length=60, verbose_name='Name on card')),
                ('cart_number',
                 models.CharField(max_length=60, verbose_name='Card number')),
                ('expiration_date',
                 models.DateField(default=datetime.date(2030, 2, 3))),
                ('billing_address', models.TextField(blank=True, null=True)),
                ('is_default', models.BooleanField(default=False)),
                ('holder',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Payment method',
                'verbose_name_plural': 'Payment methods',
            },
        ),
        migrations.AddField(
            model_name='client',
            name='delivery_address',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='account.DeliveryAddress'),
        ),
        migrations.AddField(
            model_name='client',
            name='user',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='client',
                to=settings.AUTH_USER_MODEL,
                verbose_name='Client user'),
        ),
        migrations.AddField(
            model_name='user',
            name='avatar',
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='account.Files',
                verbose_name='Avatar'),
        ),
        migrations.AddField(
            model_name='user',
            name='groups',
            field=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'),
        ),
        migrations.AddField(
            model_name='user',
            name='user_permissions',
            field=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'),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('account', '0002_auto_20191208_0442'),
    ]

    operations = [
        migrations.CreateModel(
            name='DealWatchGroup',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('source', models.CharField(max_length=20)),
                ('destination', models.CharField(max_length=20)),
                ('airlines',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('last_updated', models.DateTimeField(blank=True, null=True)),
            ],
        ),
        migrations.AddField(
            model_name='dealwatch',
            name='timestamp',
            field=models.DateTimeField(auto_now_add=True,
                                       default=django.utils.timezone.now),
            preserve_default=False,
        ),
        migrations.AlterField(
            model_name='companioninvite',
            name='invite_code',
            field=models.CharField(
                default=apps.account.models.generate_invite_code,
                max_length=50),
        ),
        migrations.AlterField(
            model_name='dealwatch',
            name='airlines',
            field=django.contrib.postgres.fields.ArrayField(
                base_field=models.CharField(max_length=10),
                blank=True,
                default=list,
                size=None),
        ),
        migrations.AlterField(
            model_name='dealwatch',
            name='max_price',
            field=models.DecimalField(blank=True,
                                      decimal_places=2,
                                      max_digits=10,
                                      null=True),
        ),
        migrations.AddField(
            model_name='dealwatch',
            name='group',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                related_name='watches',
                to='account.DealWatchGroup'),
        ),
    ]