class OrderInfo(models.Model): """ 订单详情表,多表 """ goods_name = models.CharField(verbose_name="商品名字", max_length=32) goods_price = models.FloatField(verbose_name="商品单价") goods_num = models.IntegerField(verbose_name="商品数量") goods_picture = models.CharField(max_length=64, verbose_name="商品图片") goods_total = models.FloatField(verbose_name="商品小计") goods_status = models.IntegerField(verbose_name="商品状态") store = models.ForeignKey(to=Store, on_delete=models.CASCADE) order = models.ForeignKey(to=PlaceOrder, on_delete=models.CASCADE) class Meta: db_table = "orderinfo"
class PlaceOrder(models.Model): """ 订单表,一表 """ order_num = models.CharField(max_length=32, verbose_name="订单编号") order_status = models.IntegerField( default=0, verbose_name="订单状态") # 0 代表未支付 1 代表已支付 2 发货中 type_number = models.IntegerField(default=0, verbose_name="商品数量") total_price = models.FloatField(verbose_name="订单总金额") # order_address = models.ForeignKey(to=RecvAddress,on_delete=models.CASCADE,verbose_name="收货地址") user_id = models.ForeignKey(to=QUser, on_delete=models.CASCADE, verbose_name="买家") class Meta: db_table = "placeorder"
class Migration(migrations.Migration): dependencies = [ ('Store', '0001_auto_20201026_1400'), ] operations = [ migrations.AlterField( model_name='user', name='address', field=models.TextField(), ), migrations.AlterField( model_name='user', name='contact_number', field=models.IntegerField( validators=[Store.models.validate_contact_number]), ), ]
class Migration(migrations.Migration): dependencies = [ ('Store', 'alkdj'), ] operations = [ migrations.AlterField( model_name='user', name='address', field=models.TextField(default='Aurangabad'), ), migrations.AlterField( model_name='user', name='contact_number', field=models.IntegerField( default=9876543210, validators=[Store.models.validate_contact_number]), ), ]
class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0012_alter_user_first_name_max_length'), ] operations = [ migrations.CreateModel( name='Book', fields=[ ('book_id', models.AutoField(primary_key=True, serialize=False)), ('book_name', models.CharField(max_length=50)), ('book_edition', models.DecimalField(decimal_places=2, max_digits=6)), ('book_price', models.DecimalField(decimal_places=2, max_digits=6)), ('book_quantity', models.IntegerField()), ('is_new', models.BooleanField()), ], ), migrations.CreateModel( name='Cart', fields=[ ('cart_id', models.AutoField(primary_key=True, serialize=False)), ], ), migrations.CreateModel( name='Category', fields=[ ('category_id', models.AutoField(primary_key=True, serialize=False)), ('category', models.CharField(max_length=25)), ], ), migrations.CreateModel( name='Customer', fields=[ ('customer_id', models.AutoField(primary_key=True, serialize=False)), ], ), migrations.CreateModel( name='User', fields=[ ('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')), ('user_id', models.AutoField(primary_key=True, serialize=False)), ('email_id', models.EmailField(max_length=254)), ('contact_number', models.IntegerField( validators=[Store.models.validate_contact_number])), ('address', models.TextField()), ('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()), ], ), migrations.CreateModel( name='Vendor', fields=[ ('vendor_id', models.AutoField(primary_key=True, serialize=False)), ('vendor_details', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='Payment', fields=[ ('payment_id', models.AutoField(primary_key=True, serialize=False)), ('payment_type', models.CharField(choices=[('CC', 'Credit Card'), ('DC', 'Debit Card'), ('NB', 'Net Banking'), ('GP', 'Google Pay')], max_length=4)), ('amount', models.DecimalField(decimal_places=2, max_digits=6)), ('payment_date', models.DateTimeField(auto_now_add=True)), ('cart', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Store.cart')), ('customer_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Store.customer')), ], ), migrations.AddField( model_name='customer', name='customer_details', field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.CreateModel( name='CartItem', fields=[ ('cartitem_id', models.AutoField(primary_key=True, serialize=False)), ('book_quantity', models.IntegerField()), ('book_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Store.book')), ], ), migrations.AddField( model_name='cart', name='customer_id', field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to='Store.customer'), ), migrations.AddField( model_name='book', name='category', field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to='Store.category'), ), migrations.AddField( model_name='book', name='vendor', field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to='Store.vendor'), ), ]