def gozaresh_mali(request): #request.get['username'] #request.post #l = SaleBill.objects.all()[0] #return HttpResponse('{0} and {1} and {2}'.format(l.saleDate, l.totalPrice, l.costumer.balance)) cb_objects = [] if request.method == 'POST': form = DateForm(request.POST) if form.is_valid(): startDate = form.cleaned_data['startDate'] endDate = form.cleaned_data['endDate'] cb_objects = CostBenefit.objects.filter(date__range = (startDate, endDate)) else: form = DateForm() cb_objects = CostBenefit.objects.all() paginator = Paginator(cb_objects, 25) page = request.GET.get('page') try: cb_ob = paginator.page(page) except PageNotAnInteger: # If page is not an integer, deliver first page. cb_ob = paginator.page(1) except EmptyPage: cb_ob = paginator.page(paginator.num_pages) context = {} context.update({'costBenefits': cb_ob, 'form': form}) return render(request, 'fnc/gozaresh_mali.html', context)
def alaki(request): if request.method == 'POST': form = DateForm(request.POST) if form.is_valid(): startDate = form.cleaned_data['startDate'] endDate = form.cleaned_data['endDate'] # ord = Wiki_Order.objects.filter(date__range=(startDate, endDate)) context = {'order_list': ord} return render(request, 'fnc/gozares_mali.html', context) else: form = DateForm() return render(request, 'fnc/add_sanad.html', {'form': form})