stark 1 注册模型表 2 设计URL 3 增删改 ----ModelForm ------pop 4 查看 ------表头 ------表单数据 ------分页 ------search ------action ------filter 知识点: django查找templates,先找本项目下的django查找templates,再找每一个注册app的django查找templates CRM-- 权限 stark crm逻辑 model: class classList(): teachers = models.ManyToManyField(verbose_name='任课老师', to='UserInfo',related_name="abc") tutor = models.ForeignKey(verbose_name='班主任', to='UserInfo', related_name='classes',) form: class classListForm(): teachers = models.ModelMutipleChoiceFiled(verbose_name='任课老师', to='UserInfo',related_name="abc") tutor = models.ModelChoiceFiled(verbose_name='班主任', to='UserInfo', related_name='classes',) 渲染字段: teachers: select option: UserInfo.objects.all() option: UserInfo.objects.filter(depart__in=[1002,1003]) tutor select option: UserInfo.objects.all() if class Customer(): name=models.Charfield(max...) gender = models.IntegerField(verbose_name='性别', choices=[(1,"男"),(2,"女")]) obj=Customer.objects.create(name="alex",gender=1) print(obj.gender) print(obj.get_gender_display()) # "男"
知识点1: limit_choice_to={} ModelForm model: teachers = models.ManyToManyField(verbose_name='任课老师', to='UserInfo',related_name="abc",limit_choices_to={"depart__in":[1002,1005]}) form: data=UserInfo.objects.filter(depart__in=[1002,1005]).valueslist("pk","title") teachers = forms.ModelMultiChoiceField(choices=data) 知识点2: if class Customer(): name=models.Charfield(max...) gender = models.IntegerField(verbose_name='性别', choices=[(1,"男"),(2,"女")]) obj=Customer.objects.create(name="alex",gender=1) print(obj.gender) print(obj.get_gender_display()) # "男" 知识点3: 扩展URL: temp.extend(self.extra_url()) def cancel_course(self,request,customer_id,course_id): print(customer_id,course_id) obj=Customer.objects.filter(pk=customer_id).first() obj.course.remove(course_id) return redirect(self.get_list_url()) def extra_url(self): temp=[] temp.append(url(r"cancel_course/(d+)/(d+)",self.cancel_course)) return temp
crm: 讲师与学生 1 初始化 course_record,studyrecord, 2 考勤 3 录入成绩 4 显示成绩 ajax 查询 5 上传作业(os模块) 6 下载作业 销售与客户(销售) ---公共客户(公共资源) 1 没有报名 2 3天没有跟进 3 15天没有成单 mycustomer: 龙泰 男 yuan 2018-5-1 3天未跟进 mycustomer: 龙泰 男 三江 2018-5-5 15天未成单 mycustomer: 龙泰 男 暴雨 2018-5-21 正在跟进 客户分布表 龙泰 男 yuan 2018-5-1 3天未跟进 龙泰 男 三江 2018-5-5 15天未成单 龙泰 男 暴雨 2018-5-21 正在跟进 ---我的客户 crontab: 2018-5-15 12:00 龙泰 男 三江 2018-5-5 正在跟进 2018-5-16 0:0 2018-5-17 0:0 2018-5-18 0:0 2018-5-19 0:0 龙泰 男 三江 2018-5-5 3天未跟进 key: CustomerDistrbute为什么创建 ,为什么不能直接用Customer