day29

crm开发customer relationship management客户信息没有记录和跟进记录销售抢单问题统计成单率,报表学员信息,成绩,违纪记录,学员沟通记录

功能需求客户信息表,唯一的客户id跟进记录一对多(一个人跟进多次)客户的状态,报名,未报名客户来源分析,百度,51

from django.contrib.auth.models import  User
# Create your models here.

class Customer(models.Model):
    name = models.CharField(max_length=32)
    qq = models.CharField(max_length=64,unique=True)
    weixin = models.CharField(max_length=64,blank=True,null=True)
    age = models.PositiveSmallIntegerField(blank=True,null=True)
    gender = models.PositiveIntegerField(choices=((0,‘Female‘),(1,‘Male‘)),blank=True,null=True)
    phone = models.PositiveIntegerField(blank=True,null=True)

    source_choices = ((0,‘Baidu商桥‘),
                      (1,‘51CTO‘),
                      (2,‘QQ群‘),
                      (3,‘知乎‘),
                      (4,‘SOGO‘),
                      (5,‘转介绍‘),
                      (6,‘其他‘),
                      )
    source = models.SmallIntegerField(choices=source_choices)
    referral_from = models.ForeignKey("Customer",related_name="my_referrals",
                                      blank=True,null=True,verbose_name="转介绍")

    consult_courses = models.ManyToManyField("Course")
    status_choices = ((0,‘已报名‘),(1,‘未报名‘),(2,‘已退学‘))
    status = models.SmallIntegerField(choices=status_choices)
    consultant  = models.ForeignKey("UserProfile", verbose_name="课程顾问")
    consult_content = models.TextField(max_length=1024)

    date =  models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.name

    class Meta:
        verbose_name_plural = "客户信息表"
        verbose_name = "客户信息表"

class Enrollment(models.Model):
    """学员报名信息"""
    customer = models.ForeignKey("Customer")
    class_grade = models.ForeignKey("ClassList")
    enrollment_date = models.DateField()

    def __str__(self):
        return self.customer

    class Meta:
        unique_together =  ("customer","class_grade")

class FollowUpRecord(models.Model):
    customer = models.ForeignKey("Customer")
    content = models.TextField(max_length=1024)

    status_choices = (
        (0,‘绝无报名计划‘),
        (1,‘一个月内报名‘),
        (2,‘2周内报名‘),
        (3,‘已报名其它机构‘),
    )
    status = models.SmallIntegerField(choices=status_choices)
    consultant  = models.ForeignKey("UserProfile", verbose_name="课程顾问")

    date = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return "%s" % self.customer

class Course(models.Model):
    name = models.CharField(unique=True,max_length=64)
    price = models.PositiveIntegerField(default=19800)
    outline = models.TextField()

    def __str__(self):
        return self.name

class ClassList(models.Model):
    course = models.ForeignKey("Course")
    semester = models.PositiveSmallIntegerField(verbose_name="学期")
    class_type_choices = ((0,‘脱产‘),(1,‘周末‘),(2,‘网络‘))
    branch  = models.ForeignKey("Branch")
    class_type = models.PositiveSmallIntegerField(choices=class_type_choices)
    teachers = models.ManyToManyField("UserProfile")
    start_date = models.DateField()
    end_date = models.DateField()

    def __str__(self):
        return "%s" % self.course

class CourseRecord(models.Model):
    """每节课上课纪录"""
    class_grade = models.ForeignKey("ClassList")
    day_number = models.PositiveSmallIntegerField(verbose_name="节次")
    teacher = models.ForeignKey("UserProfile")
    CourseContent = models.TextField(verbose_name="课程内容",max_length=1024)
    has_homework = models.BooleanField(default=True)
    homework_title = models.CharField(max_length=128,blank=True,null=True)
    homework_requirement = models.TextField(verbose_name="作业需求",max_length=1025,blank=True,null=True)

    def __str__(self):
        return " daynum:%s" %(self.day_number)

    class Meta:
        unique_together = ("class_grade","day_number")

class StudyRecord(models.Model):
    """每个学生上的每节课的成绩纪录"""
    course_record = models.ForeignKey("CourseRecord")
    student  = models.ForeignKey("Enrollment")
    score_choices = ((100,"A+"),
                     (90,"A"),
                     (85,"B+"),
                     (80,"B"),
                     (75,"B-"),
                     (70,"C+"),
                     (65,"C"),
                     (40,"C-"),
                     (-20,"D"),
                     (-50,"COPY"),
                     (0,"N/A"),
                     )
    score = models.SmallIntegerField(choices=score_choices)
    show_status_choices = ((0,"缺勤"),(1,"已签到"),(2,"迟到"))
    show_status = models.SmallIntegerField(choices=show_status_choices)
    grade_comment = models.TextField(max_length=1024,blank=True,null=True)

    def __str__(self):
        return "%s  daynum:%s" % (self.course_record, self.student)

    class Meta:
        unique_together = ("course_record", "student")

class UserProfile(models.Model):
    user = models.OneToOneField(User)
    name = models.CharField(max_length=32)

    roles = models.ManyToManyField("Role",blank=True,null=True)

    def __str__(self):
        return self.name

class Role(models.Model):
    """角色表"""
    name = models.CharField(unique=True,max_length=32)
    menus = models.ManyToManyField("Menu")

    def __str__(self):
        return self.name

class Branch(models.Model):
    """分校"""
    name = models.CharField(unique=True,max_length=128)

    def __str__(self):
        return self.name

class Menu(models.Model):
    """动态菜单"""
    name = models.CharField(unique=True,max_length=32)
    url_type = models.SmallIntegerField(choices=((0,‘relative_name‘),(1,‘absolute_url‘)))
    url_name = models.CharField(unique=True,max_length=128)

    def __str__(self):
        return self.name
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)
    qq = models.CharField(max_length=64,unique=True)
    weixin = models.CharField(max_length=64,blank=True,null=True)
    age = models.PositiveSmallIntegerField(blank=True,null=True)
    gender = models.PositiveIntegerField(choices=((0,‘Female‘),(1,‘Male‘)),blank=True,null=True)
    phone = models.PositiveIntegerField(blank=True,null=True)

    source_choices = ((0,‘Baidu商桥‘),
                      (1,‘51CTO‘),
                      (2,‘QQ群‘),
                      (3,‘知乎‘),
                      (4,‘SOGO‘),
                      (5,‘转介绍‘),
                      (6,‘其他‘),
                      )
    source = models.SmallIntegerField(choices=source_choices)
    referral_from = models.ForeignKey("Customer",related_name="my_referrals",
                                      blank=True,null=True,verbose_name="转介绍")

    consult_courses = models.ManyToManyField("Course")
    status_choices = ((0,‘已报名‘),(1,‘未报名‘),(2,‘已退学‘))
    status = models.SmallIntegerField(choices=status_choices)
    consultant  = models.ForeignKey("UserProfile", verbose_name="课程顾问")
    consult_content = models.TextField(max_length=1024)

    date =  models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.name

    class Meta:
        verbose_name_plural = "客户信息表"
        verbose_name = "客户信息表"

class Enrollment(models.Model):
    """学员报名信息"""
    customer = models.ForeignKey("Customer")
    class_grade = models.ForeignKey("ClassList")
    enrollment_date = models.DateField()

    def __str__(self):
        return self.customer

    class Meta:
        unique_together =  ("customer","class_grade")

class FollowUpRecord(models.Model):
    customer = models.ForeignKey("Customer")
    content = models.TextField(max_length=1024)

    status_choices = (
        (0,‘绝无报名计划‘),
        (1,‘一个月内报名‘),
        (2,‘2周内报名‘),
        (3,‘已报名其它机构‘),
    )
    status = models.SmallIntegerField(choices=status_choices)
    consultant  = models.ForeignKey("UserProfile", verbose_name="课程顾问")

    date = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return "%s" % self.customer

class Course(models.Model):
    name = models.CharField(unique=True,max_length=64)
    price = models.PositiveIntegerField(default=19800)
    outline = models.TextField()

    def __str__(self):
        return self.name

class ClassList(models.Model):
    course = models.ForeignKey("Course")
    semester = models.PositiveSmallIntegerField(verbose_name="学期")
    class_type_choices = ((0,‘脱产‘),(1,‘周末‘),(2,‘网络‘))
    branch  = models.ForeignKey("Branch")
    class_type = models.PositiveSmallIntegerField(choices=class_type_choices)
    teachers = models.ManyToManyField("UserProfile")
    start_date = models.DateField()
    end_date = models.DateField()

    def __str__(self):
        return "%s" % self.course

class CourseRecord(models.Model):
    """每节课上课纪录"""
    class_grade = models.ForeignKey("ClassList")
    day_number = models.PositiveSmallIntegerField(verbose_name="节次")
    teacher = models.ForeignKey("UserProfile")
    CourseContent = models.TextField(verbose_name="课程内容",max_length=1024)
    has_homework = models.BooleanField(default=True)
    homework_title = models.CharField(max_length=128,blank=True,null=True)
    homework_requirement = models.TextField(verbose_name="作业需求",max_length=1025,blank=True,null=True)

    def __str__(self):
        return " daynum:%s" %(self.day_number)

    class Meta:
        unique_together = ("class_grade","day_number")

class StudyRecord(models.Model):
    """每个学生上的每节课的成绩纪录"""
    course_record = models.ForeignKey("CourseRecord")
    student  = models.ForeignKey("Enrollment")
    score_choices = ((100,"A+"),
                     (90,"A"),
                     (85,"B+"),
                     (80,"B"),
                     (75,"B-"),
                     (70,"C+"),
                     (65,"C"),
                     (40,"C-"),
                     (-20,"D"),
                     (-50,"COPY"),
                     (0,"N/A"),
                     )
    score = models.SmallIntegerField(choices=score_choices)
    show_status_choices = ((0,"缺勤"),(1,"已签到"),(2,"迟到"))
    show_status = models.SmallIntegerField(choices=show_status_choices)
    grade_comment = models.TextField(max_length=1024,blank=True,null=True)

    def __str__(self):
        return "%s  daynum:%s" % (self.course_record, self.student)

    class Meta:
        unique_together = ("course_record", "student")

class UserProfile(models.Model):
    user = models.OneToOneField(User)
    name = models.CharField(max_length=32)

    roles = models.ManyToManyField("Role",blank=True,null=True)

    def __str__(self):
        return self.name

class Role(models.Model):
    """角色表"""
    name = models.CharField(unique=True,max_length=32)
    menus = models.ManyToManyField("Menu")

    def __str__(self):
        return self.name

class Branch(models.Model):
    """分校"""
    name = models.CharField(unique=True,max_length=128)

    def __str__(self):
        return self.name

class Menu(models.Model):
    """动态菜单"""
    name = models.CharField(unique=True,max_length=32)
    url_type = models.SmallIntegerField(choices=((0,‘relative_name‘),(1,‘absolute_url‘)))
    url_name = models.CharField(unique=True,max_length=128)

    def __str__(self):
        return self.name
时间: 2024-10-07 04:16:53

day29的相关文章

leetcode -day29 Binary Tree Inorder Traversal & Restore IP Addresses

1.  Binary Tree Inorder Traversal Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [1,3,2]. Note: Recursive solution is trivial, could you do it iteratively? 分析:求二叉树的中序

javascript实现掉落弹出层------Day29

顾名思义,所谓"掉落弹出层",就是出现一个弹出层,而出现的位置是从上方向下掉落,掉落到指定的位置停止,这样分析起来,和"右下角弹出提醒对话框"比起来,确有异曲同工之妙啊,一个从上向下,一个由下及上. 实现原理: 我们不妨肢解了这个动作来看,可以大概分为这几个部分: 1.弹出弹出层,弹出层位置在屏幕上方不可见: 2.弹出层从上而下的降落: 3.弹出层到达指定位置,停止降落: 如果加上缓冲弹跳效果的话,就是四部分: 4.出现缓冲弹跳效果,直到静止,而弹跳效果简单了说,就

8.11数据库设计 Day29

---note--- 数据库设计 需求分析 概念结构设计是关键 E-R图 逻辑结构设计 把E-R图转换成数据模型的对应结构 数据库物理设计阶段 数据库实施阶段 数据库运行和维护 数据库字典:数据项,数据结构,数据流,数据存储,处理过程 水平分解:把基本关系的元组分为若干个子集合,定义每一个集合为一个子关系,以提高系统的效率 ---note---

Day29:协程

一.协程 协程,又称微线程,纤程.英文名Coroutine.一句话说明什么是线程:协程是一种用户态的轻量级线程. 协程拥有自己的寄存器上下文和栈.协程调度切换时,将寄存器上下文和栈保存到其他地方,在切回来的时候,恢复先前保存的寄存器上下文和栈.因此: 协程能保留上一次调用时的状态(即所有局部状态的一个特定组合),每次过程重入时,就相当于进入上一次调用的状态,换种说法:进入上一次离开时所处逻辑流的位置. 1.1 yield与协程 import time """ 传统的生产者-消

新工作 Day29 周四(开始春节假期)

明天开始放假了,可以好好休整一下.重构的事正做在关键时候,可以连VPN继续,过年期间还是要把这个重构好,体现一下能力,尽早转正. 5号~15号春节假期,过年这几天也没什么好写的了,有碰到特别的事再记录吧. 最近眼睛盯着屏幕看,经常酸痛,以后对着电脑时,每小时都要起来喝水.上厕所.眺望远方,不然眼睛真会撑不住. ================= 晚上看了Bojack.Horseman 第二季的两集,真是神剧,要不断暂停才能看全细节

Python开发基础-Day29多线程

概念 进程:进程就是一个程序在一个数据集上的一次动态执行过程 程序:代码 数据集:程序执行过程中需要的资源 进程控制块:完成状态保存的单元 线程:线程是寄托在进程之上,为了提高系统的并发性 线程是进程的实体 进程是一个资源管理单元.线程是最小的执行单元 线程和进程的关系 (1)一个线程只能属于一个进程,而一个进程可以有多个线程,但至少有一个线程.(2)资源分配给进程,同一进程的所有线程共享该进程的所有资源.(3)CPU分给线程,即真正在CPU上运行的是线程. 进程/线程切换原则:切换的操作者,操

框架 day29 Struts2-上传,下载,OGNL与Struts2的结合(值栈与ActionContext),Struts2标签

文件上传 1.1回顾 *浏览器端: <formmethod="post" enctyp="multipart/form-data"> <inputtype="file" name="image"> <inputtype="submit"> *服务器端: 手动方式 第三方:commons-fileupload  核心类ServletFileUpload 1.2介绍 *str

day29 面向对象入门

Python之路,Day17 = Python基础17-面向对象入门 创建类和对象 面向对象编程是一种编程方式,此编程方式的落地需要使用 "类" 和 "对象" 来实现,所以,面向对象编程其实就是对 "类" 和 "对象" 的使用. 类就是一个模板,模板里可以包含多个函数,函数里实现一些功能 对象则是根据模板创建的实例,通过实例对象可以执行类中的函数 class是关键字,表示类 创建对象,类名称后加括号即可 ps:类中的函数第一个

Summary Day29

1.  C语言的 错误处理 return 0;//程序正常结束 return -1;//程序异常结束 1.1  C语言通过返回值表示错误的形式,一般规则如下: (1)如果函数的返回值类型是int类型,并且函数的返回值不可能是负数时, 则返回0表示正常结束,返回-1表示出错 (2)如果函数返回值类型int 类型,函数的返回值可能是负数时, 使用指针作为函数形参将函数的结果带回去,然后使用0表示正常结束,-1表示错误 (3)如果函数的返回值类型是指针类型,则返回NULL表示失败,其他值表示正常结束