def get_xls_export(self, context): output = StringIO.StringIO() year = context['year'] month = context['month'] exportDetail = context['exportDetail'] result = get_payment_summary(self, int(year), int(month)) book = generate_payment_summary(result, bool(int(exportDetail))) book.save(output) output.seek(0) return output.getvalue()
def post(self, request, *args, **kwargs): if 'year' in request.POST: year = request.POST['year'] if 'month' in request.POST: month = request.POST['month'] response = self.get(request) context = response.context_data result = get_payment_summary(self, int(year), int(month)) context['result'] = result context['year'] = str(year) context['month'] = int(month) return response