def get(self, request): """ 查看跟进记录 :param request: :return: """ # 查询指定客户的跟进记录 cid = request.GET.get('cid') if cid: consult_record = ConsultRecord.objects.filter(customer_id=cid) if consult_record and not consult_record.first( ).consultant == request.user and consult_record.first().consultant: return HttpResponse('非法操作,你没有权限查看该客户的记录') else: consult_record = ConsultRecord.objects.filter( consultant=request.user) current_page_num = request.GET.get('page', 1) pagination = Pagination(request, current_page_num, consult_record) page_html, consult_record, counter = pagination.page_html() return render( request, 'consult_record.html', { 'consult_record': consult_record, 'page_html': page_html, 'counter': counter })
def get(self, request): if request.path == reverse('my_customer'): customer_list = Customer.objects.filter(consultant=request.user) label = '我的客户' elif request.path == reverse('customer_all'): customer_list = Customer.objects.all() label = '所有客户' else: customer_list = Customer.objects.filter(consultant__isnull=True) label = '公有客户' current_page_num = request.GET.get('page', 1) pagination = Pagination(request, current_page_num, customer_list) page_html, customer_list, counter = pagination.page_html() class_list = ClassList.objects.all() consultrecord_list = UserInfo.objects.filter( positions__depart__name='销售部') url_parms = self.conditions(request) return render( request, 'customer.html', { 'page_html': page_html, 'customer_list': customer_list, 'counter': counter, 'label': label, 'current_page_num': current_page_num, 'class_list': class_list, 'status': enroll_status_choices, 'consultrecord_list': consultrecord_list, 'url_parms': url_parms })
def get(self, request): all_csr = ClassStudyRecord.objects.all() current_page_num = request.GET.get('page', 1) pagination = Pagination(request, current_page_num, all_csr) page_html, all_csr, counter = pagination.page_html() return render(request, 'class_study_record.html', {'page_html': page_html, 'all_csr': all_csr, 'counter': counter, })
def show_student(request): all_student = Student.objects.all() current_page_num = request.GET.get('page', 1) pagination = Pagination(request, current_page_num, all_student) page_html, all_student, counter = pagination.page_html() return render(request, 'student.html', {'page_html': page_html, 'all_student': all_student, 'counter': counter, })
def get(self, request): today = datetime.date.today() yesterday = today - datetime.timedelta(days=1) week = today - datetime.timedelta(weeks=1) month = today - datetime.timedelta(weeks=4) condition_dict = { 'today': [{ 'deal_date': today }, { 'customers__deal_date': today }], 'yesterday': [{ 'deal_date': yesterday }, { 'customers__deal_date': yesterday }], 'week': [{ 'deal_date__gte': week }, { 'customers__deal_date__gte': week }], 'month': [{ 'deal_date__gte': month }, { 'customers__deal_date__gte': month }] } condition = request.GET.get('date', 'today') customer_obj = Customer.objects.filter( **condition_dict[condition][0]).order_by('-deal_date') u_obj = UserInfo.objects.filter(positions__depart_id=1, **condition_dict[condition][1]).values( 'username', 'customers').distinct() ret = {} for item in u_obj: if item['username'] in ret.keys(): ret[item['username']] += 1 else: ret[item['username']] = 1 ret = [[k, v] for k, v in ret.items()] current_page_num = request.GET.get('page', 1) pagination = Pagination(request, current_page_num, customer_obj) page_html, customer_obj, counter = pagination.page_html() return render( request, 'count_customer.html', { 'customer_obj': customer_obj, 'page_html': page_html, 'counter': counter, 'ret': ret })
def get(self, request, cid): ssr_obj = StudentStudyRecord.objects.filter(classstudyrecord_id=cid) ssr_obj = copy.deepcopy(ssr_obj) title = ClassStudyRecord.objects.filter(pk=cid).first() for item in ssr_obj: item.forms = CreateGradeMF(instance=item) current_page_num = request.GET.get('page', 1) pagination = Pagination(request, current_page_num, ssr_obj) page_html, ssr_obj, counter = pagination.page_html() return render(request, 'create_grade.html', {'page_html': page_html, 'ssr_obj': ssr_obj, 'counter': counter, 'title': title, })