def get(self,request): now_time=datetime.datetime.now() now_week=tools.get_week(times=now_time) now_week_questions=Questions.analysis_questions_question(now_week) all_questions=Questions.analysis_questions_question() not_done_questions=list(Questions.get_question_not_done()) return render(request,"questions/report.html",dict(now_week_questions=now_week_questions,not_done_questions=not_done_questions,all_questions=all_questions))
def update_questions(id=None,**kwargs): try: kwargs['update_time']=datetime.datetime.now() kwargs['week']=tools.get_week(times=datetime.datetime.now()) Questions_Model.objects.filter(id=id).update(**kwargs) msg=dict(status=0,msg="update success") except Exception,e: msg=dict(status=1,msg="update failed",detail=str(e))
def get(self,request): now_time = datetime.datetime.now() now_week = tools.get_week(times=now_time) now_week_questions = Questions.analysis_questions_question(now_week) all_questions = Questions.analysis_questions_question() not_done_questions = list(Questions.get_question_not_done()) send_content=dict(now_week_questions=now_week_questions,not_done_questions=not_done_questions,all_questions=all_questions) tools.send_week_report(send_content) return self.render_json_response(dict(status=0,msg='success'))
def get(self,request): module_name=request.GET.get("module_name",None) now_week = request.GET.get("now_week",None) if (now_week != None and int(now_week) == 1): time_week=tools.get_week(times=datetime.datetime.now()) else: time_week=None data=Questions.query_questions(query_module_name=module_name,time_week=time_week) module_list = Module().get_module("module_name") project_list = Project().get_progect("project_name") progress_list = Progress().get_progress("progress_name") page = request.GET.get("page", 1) page_size = request.GET.get("page_size", 10) data, paginator = self.paginate(data, page_size=page_size, page=page) response_data = dict(module_list=module_list, project_list=project_list, progress_list=progress_list, questions_list=data, paginator=paginator) return render(request, "questions/list.html", response_data)
def add_questions(**kwargs): kwargs["week"]=tools.get_week(times=datetime.datetime.now()) questions=Questions_Model.objects.create(**kwargs) return dict(id=questions.id)