def show_most_liked_comments(self): renderer = XLSRenderer() now = datetime.now() filename = now.strftime( _(u'eureka_most_liked_comments_week_%U_%Y.xls')) MostLikedComments().render(renderer, now, 500) raise excel_response(renderer.get_content(), filename)
def export_xls(self): state_changed_ideas = self.find_state_changed_ideas(reverse=True) r = XLSRenderer() center_top = r.Style.Centered + r.Style.VerticalAlignTop left_top = r.Style.VerticalAlignTop heading = r.Style.ColumnHeading + r.Style.VerticalAlignCenter + r.Style.Wrap + r.Background.LightYellow with r.sheet(_(u"Ideas on alert")): with r.row: r << r.cell(_(u"State changes"), style=heading) r << r.cell(_(u'Challenge'), style=heading) r << r.cell(_(u'Ideas'), style=heading) for (from_state, to_state), ideas in state_changed_ideas: for idx, (idea, __) in enumerate(ideas): with r.row: if not idx: r << r.cell(u'%s\n⬇\n%s (%d)' % (_(from_state.label), _( to_state.label), len(ideas)), rowspan=len(ideas), style=center_top) r << r.cell(u'#%d' % idea.challenge.id if idea.challenge else '', style=center_top) r << r.cell(u'N°%d - %s' % (idea.id, idea.title), style=left_top) raise excel_response(r.get_content(), filename='idees_en_alerte.xls')
def export_xls(self): state_changed_ideas = self.find_state_changed_ideas(reverse=True) r = XLSRenderer() center_top = r.Style.Centered + r.Style.VerticalAlignTop left_top = r.Style.VerticalAlignTop heading = r.Style.ColumnHeading + r.Style.VerticalAlignCenter + r.Style.Wrap + r.Background.LightYellow with r.sheet(_(u"Ideas on alert")): with r.row: r << r.cell(_(u"State changes"), style=heading) r << r.cell(_(u'Challenge'), style=heading) r << r.cell(_(u'Ideas'), style=heading) for (from_state, to_state), ideas in state_changed_ideas: for idx, (idea, __) in enumerate(ideas): with r.row: if not idx: r << r.cell(u'%s\n⬇\n%s (%d)' % (_(from_state.label), _(to_state.label), len(ideas)), rowspan=len(ideas), style=center_top) r << r.cell( u'#%d' % idea.challenge.id if idea.challenge else '', style=center_top) r << r.cell(u'N°%d - %s' % (idea.id, idea.title), style=left_top) raise excel_response(r.get_content(), filename='idees_en_alerte.xls')
def export_xls(self, filename=None, title=_(u'Users')): renderer = XLSRenderer() self.render_xls(renderer, title) timestamp = datetime.now().date().isoformat() filename = filename or '%s-%s.xls' % (timestamp, fix_filename(title)) raise excel_response(renderer.get_content(), filename)
def show_most_liked_comments(self): renderer = XLSRenderer() now = datetime.now() filename = now.strftime(_(u'eureka_most_liked_comments_week_%U_%Y.xls')) MostLikedComments().render(renderer, now, 500) raise excel_response(renderer.get_content(), filename)