示例#1
0
def create_fiscalreport(request):
    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="fiscal_report.csv"'
    year = request.GET.get('y', '')
    if year == '':
        now = datetime.datetime.now()
        year = now.year() - 1
    FiscalReport.getReportingValues(year=year, output=response)
    return response
示例#2
0
    def test_fiscal_reports(self):
        """
        contributor 4 did not donate enough to receive a fiscal report. Contributor 3 only contributed the year before.
        Only contributors 1 and 2 should be included
        """

        # just to make sure: no reports are present in the database yet
        indiv_reports = IndividualFiscalReport.objects.filter(year=self.reference_date.year)
        self.assertEqual(len(indiv_reports), 0)
        report = FiscalReport.getReportingValues(year=self.reference_date.year)
        indiv_reports = IndividualFiscalReport.objects.filter(year=self.reference_date.year)
        self.assertEqual(len(indiv_reports), 2)