def monthly(request,template_name="reports/report.html"): postdata = request.POST.copy() form = ReportForm() date = postdata.get('date',) resp = HttpResponse(mimetype='application/pdf') orders = Order.objects.filter(date = date) report = ReportOrders(queryset=orders) try: report.generate_by(PDFGenerator, filename=resp) return resp except EmptyQueryset, e: print e
def report(request,template_name="reports/report.html"): if request.method == 'POST': form = ReportForm(request.POST) if form.is_valid(): resp = HttpResponse(mimetype='application/pdf') date = form.data['date'] orders = Order.objects.filter(date = date) report = ReportOrders(queryset=orders) try: report.generate_by(PDFGenerator, filename=resp) return resp except EmptyQueryset, e: print e