33

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(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(choices=status_choices,default=1)
def __str__(self):
return self.qq

class Meta:
verbose_name_plural = '客户信息表'

class Tag(models.Model):
name = models.CharField(unique=True,max_length=32)

def __str__(self):
return self.name

class Meta:
verbose_name_plural = '标签'
posted @ 2017-01-08 22:17  hello-Jesson  阅读(127)  评论(0编辑  收藏  举报