6.27-6.28 JLL--实习日志Tips for Horizon+ retail_interface
来源:互联网 发布:davinci软件 编辑:程序博客网 时间:2024/06/08 06:41
- 下拉框机制的整体运行的流程
1.1在form_policy
下面 会有一个true_false_choice =[ ('后台',u''),()]
表示的下拉框的显示值,
1.2selection_box.py
有一个selection_box = []
作用是在前端进行识别,如果在这个list 里面的都会被默认为 下拉框的形式 ,相当于一个 快捷键的形式
1.3form.py
中有一个属性是widgets
表示的是 里面决定了下拉框 的内容, 表示的是这个form里面有两个下拉框 ,并且下拉框的值
widgets = {'EmployeeTitle': forms.Select(choices=employee_title_choices), 'EmployeeDepartment': forms.Select(choices=employee_department_choices), }
1.4 前端 判断 是不是在 selectionbox
里面 如果是在selectionbox
里面就形成新的下拉框的形式
1.5 小知识点,label 的for 标签就是相当于id的作用,并且是自动实现的,格式是id_field.label_tag
<label for="id_Pref_Brand_Name_Flg">Preferred Brand Name Flag:</label>
1.6 前端通过 Js的方式,进行check 的机制 和样式选择 <select class="form-control">
需要写一些 interface
要求 如下
Add a search page in navbar to get full JLL broker list, using value from User Role. Reference the code from view_jll_contact.Add new attributes to indicate and protect primary broker:PrimaryBroker: a foreign key field (null=True, blank=True) in brand level to reference user role.Add a timeout mechanism in the primary broker list interface under brand detail with a timeout configuration parameter (default to 120 days).If last conversation timestamp from primary broker is not timeout:list the current PrimaryBroker as 1st, and set 2nd - 5th brokers using current logic.If last conversation timestamp from primary broker is timeout:Change the PrimaryBroker to the most up-to-date conversation owner.list the current PrimaryBroker as 1st, and set 2nd - 5th brokers using current logic.Add a function SetPrimaryBroker, with a GET parameter "brand_id" (No front-end UI for now, this function would be used in future stage):If current primary broker cannot reference to a user role (which means blank):Use brand_id and user (get the UserRole) to add primary broker in Brand.If current primary broker reference to a user role:Remove current UserRole reference in brand (use brand_id to get).Use brand_id and user (get the UserRole) to add primary broker in Brand.
view 端
需要有个leader设置primary-contact的功能,set_primary_contact
输入的是 userrole_id,brand_id
然后save
有一个定期刷新的primary-contact 的 功能,refresh_primary_contact()
def refresh_primary_contact(): Conversation_instances = Conversation_Brand.objects.all() brand_instances = Brand.objects.all() for brand_instance in brand_instances: conversations = Conversation_Brand.objects.filter(Q(Brand=brand_instance)).order_by('-Created_On')[:5] #check the proetcctperiod exist ? check outtime ? if not brand_instance.PrimaryContact:# no PrimaryContact add ,else check the timestamp conversation_instance = Conversation_Brand.objects.filter(Q(Brand=brand_instance)).order_by('-Created_On').first() if conversation_instance: brand_instance.PrimaryContact = Conversation_Brand.objects.filter(Q(Brand=brand_instance)).order_by('-Created_On').first().JLL_Contact else: if (brand_instance.Protect_period +str(120) <= time.strftime('%Y%m%d')): brand_instance.Protect_period = ''# free the protect conversation_time_stamp = Conversation_Brand.objects.filter(~Q(Brand.PrimaryContact == None)).order_by('-Created_On')[0].Modified_On.timetuple() conversation_time_stamp1 = int(time.mktime(conversation_time_stamp)*1000) now = datetime.datetime.now() now_time_stamp = int(time.mktime(now)*1000) time_minus = round((now_time_stamp-conversation_time_stamp1)/ 86400); if time_minus >= 120: brand_instance.PrimaryContact = Conversation_Brand.objects.filter(Q(Brand=brand_instance)).order_by('-Created_On')[0].JLL_Contact brand_instance.save() return True@login_required def set_primary_contact(brand_id,userrole_id): brand_instance=get_object_or_404(Brand,pk=int(brand_id)) user_role = get_object_or_404(UserRole,pk=int(userrole_id)) brand_instance.Protect_period = time.strftime('%Y%m%d %H%M') brand_instance.save() return True
阅读全文
0 0
- 6.27-6.28 JLL--实习日志Tips for Horizon+ retail_interface
- 5.3 JLL 实习日志
- 5.5 JLL 实习日志
- 5.9 JLL实习日志
- 5.27 JLL--实习日志--
- 6.5 JLL--实习日志
- 6.16-6.19 JLL--实习日志--
- 6.22-6.27 JLL--实习日志--Ajax+js 端实现
- 5.26 JLL--实习日志--Primary_Image+total_setting
- 6.15 JLL--实习日志--SetupNewWorkSpace on cloud9
- 7.14-7.21 JLL实习日志-DropDownBox Upgrade
- 8.29-8.30 JLL实习日志-validate deprecated
- 9.1-9. JLL实习日志-未完结
- 7.8-7.10 JLL实习日志-DjangoAPI+python+json,post for many records in a time
- 5.4 JLL 实习日志 –form 表单问题
- 5.11 JLL实习日志-实现download功能实现
- 5.10 JLL实习日志-实现upload 功能实现
- 5.12 JLL实习日志-实现download功能实现
- Android开源数据库框架之LitePal
- Linux 线程同步的三种方法
- Linux 如何测试 IO 性能(磁盘读写速度)
- 2017.6.27 python学习 面向对象编程
- linux gdb
- 6.27-6.28 JLL--实习日志Tips for Horizon+ retail_interface
- hbuilder安卓生成 证书以及打包
- quick-coos2d-3.3中定时器/帧事件
- 求 [1,n-1]中 与 n 的 GCD 值的和
- mui
- Android JNI编程之基础学习(一) 认识c语言的基本类型,输出输入函数
- C++学习笔记(二)
- SpringMVC实战(一) —— HelloWorld
- httpclient 传递参数的问题