def test_renderer_output(self): self.setup_test_data() request = testing.DummyRequest() renderer = TablibXLSXRenderer({}) municipality = Municipality.all()[0] data = { 'municipality': municipality, 'start': datetime.date(2014, 6, 1), 'end': datetime.date(2014, 6, 30) } renderer(data, {'request': request}) self.assertEqual( request.response.content_type, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ) # noqa
def municipality_widget(node, kw): # start with a blank municipalities = [('', '')] municipalities.extend([(m.id, m.name) for m in Municipality.all()]) return SelectWidget(values=municipalities)