Python代码
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Customer(models.Model):
'''客户信息表'''
name = models.CharField(max_length=32,blank=True,null=True)
qq = models.CharField(max_length=64,unique=True)
qq_name = models.CharField(max_length=64,blank=True,null=True)
phone = models.CharField(max_length=64,blank=True,null=True)
source_choices = ((0,'转介绍'),
(1,'QQ群'),
(2,'官网'),
(3,'百度推广'),
(4,'51CTO'),
(5,'知乎'),
(6,'市场推广')
)
source = models.SmallIntegerField(verbose_name="报名渠道",choices=source_choices)
referral_from = models.CharField(verbose_name="转介绍人qq",max_length=64,blank=True,null=True)
consult_course = models.ForeignKey("Course",verbose_name="咨询课程")
content = models.TextField(verbose_name="咨询详情")
tags = models.ManyToManyField("Tag",blank=True,null=True)
consultant = models.ForeignKey("UserProfile")
memo = models.TextField(blank=True,null=True)
date = models.DateTimeField(auto_now_add=True)
status_choices = ((0,'已报名'),
(1,'未报名'),)
status = models.SmallIntegerField(verbose_name="报名状态",choices=status_choices,default=1)
def __str__(self):
return self.qq
class Meta:
verbose_name = "客户表"
verbose_name_plural = '客户信息表'