parent
0545071d7b
commit
04b9a642aa
2 changed files with 65 additions and 0 deletions
@ -1,3 +1,30 @@ |
||||
from datetime import datetime |
||||
|
||||
from django.db import models |
||||
|
||||
|
||||
# Create your models here. |
||||
|
||||
|
||||
class Address(models.Model): |
||||
""" |
||||
用户配送地址 |
||||
""" |
||||
province = models.CharField(verbose_name='省份', max_length=50, default='') |
||||
city = models.CharField(verbose_name='城市', max_length=50, default='') |
||||
district = models.CharField(verbose_name='区域', max_length=50, default='') |
||||
address = models.CharField(verbose_name='详细地址', max_length=100, default='') |
||||
contact_name = models.CharField(verbose_name='联系人', max_length=20, default='') |
||||
contact_mobile = models.CharField(verbose_name='联系电话', max_length=11, default='') |
||||
user = models.ForeignKey(verbose_name='用户', to='', on_delete=models.DO_NOTHING) |
||||
is_default = models.IntegerField(verbose_name='是否是默认配送地址', default=0) # 0 不是 1 是 |
||||
create_date = models.DateTimeField(verbose_name='创建时间', default=datetime.now()) |
||||
|
||||
def __str__(self): |
||||
return self.province + self.city + self.district + self.address |
||||
|
||||
class Meta: |
||||
verbose_name = '用户配送地址' |
||||
verbose_name_plural = '用户配送地址' |
||||
managed = True |
||||
db_table = 'd_address' |
||||
|
@ -1,3 +1,41 @@ |
||||
from django.db import models |
||||
from django.contrib.auth.models import AbstractUser |
||||
|
||||
|
||||
# Create your models here. |
||||
|
||||
|
||||
class MyUser(AbstractUser): |
||||
SEX = ( |
||||
(0, '男'), |
||||
(1, '女') |
||||
) |
||||
LEVEL = ( |
||||
(1, '寂寞卡会员'), |
||||
(2, '钻石卡会员'), |
||||
(3, '金卡会员'), |
||||
(4, '银卡会员') |
||||
) |
||||
STATUS = ( |
||||
(0, '正常'), |
||||
(1, '异常') |
||||
) |
||||
|
||||
true_name = models.CharField(verbose_name='真实姓名', max_length=50, blank=True) |
||||
mobile = models.CharField(verbose_name='手机号码', max_length=11, default='') |
||||
sex = models.IntegerField(verbose_name='性别', choices=SEX) |
||||
birthday = models.DateField(verbose_name='生日', blank=True, null=True) |
||||
nickname = models.CharField(verbose_name='昵称', max_length=50, blank=True) |
||||
user_img = models.ImageField(verbose_name='头像', upload_to='user_mage', default='') |
||||
level = models.IntegerField(verbose_name='用户级别', choices=LEVEL) |
||||
status = models.IntegerField(verbose_name='用户状态', choices=STATUS) |
||||
create_time = models.DateTimeField(verbose_name='创建时间', auto_now_add=True) |
||||
update_time = models.DateTimeField(verbose_name='更新时间', auto_now=True) |
||||
|
||||
def __str__(self): |
||||
return self.username |
||||
|
||||
class Meta(AbstractUser.Meta): |
||||
permissions = ( |
||||
['check_myuer', '审核用户信息'], |
||||
) |
||||
|
Loading…
Reference in new issue