def fillresponse(self, begin_date, end_date): self.item.set_dates(begin_date, end_date) date_init = XferCompDate("begin_date") date_init.set_needed(True) date_init.set_value(self.item.date_begin) date_init.set_location(1, 0) date_init.description = _('initial date') date_init.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH) self.add_component(date_init) date_end = XferCompDate("end_date") date_end.set_needed(True) date_end.set_value(self.item.date_end) date_end.set_location(3, 0) date_end.description = _('current date') date_end.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH) self.add_component(date_end) XferShowEditor.fillresponse(self) self.add_action(ActionsManage.get_action_url('payoff.Supporting', 'Show', self), close=CLOSE_NO, params={'item_name': self.field_id}, pos_act=0) self.add_action(ActionsManage.get_action_url('payoff.Supporting', 'Email', self), close=CLOSE_NO, params={'item_name': self.field_id}, pos_act=0)
def fillresponse(self, begin_date, end_date): self.item.set_dates(begin_date, end_date) date_init = XferCompDate("begin_date") date_init.set_needed(True) date_init.set_value(self.item.date_begin) date_init.set_location(1, 0) date_init.description = _('initial date') date_init.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH) self.add_component(date_init) date_end = XferCompDate("end_date") date_end.set_needed(True) date_end.set_value(self.item.date_end) date_end.set_location(2, 0) date_end.description = _('current date') date_end.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH) self.add_component(date_end) img = XferCompImage('img') img.set_value(self.icon_path()) img.set_location(0, 0, 1, 6) self.add_component(img) self.fill_from_model(1, 1, True, [((_('name'), 'third'),)]) grid = XferCompGrid('loadcount') grid.set_model(self.item.loadcount_set.all(), None) grid.set_location(1, 2, 2) self.add_component(grid) self.add_action(WrapAction(_('Close'), 'images/close.png'))
def _add_season_comp(self, xfer, row): season = self.item.season if self.item.subscriptiontype.duration == 0: # annually lbl = XferCompLabelForm("seasondates") lbl.set_location(1, row) lbl.set_value( "%s => %s" % (formats.date_format(season.begin_date, "SHORT_DATE_FORMAT"), formats.date_format(season.end_date, "SHORT_DATE_FORMAT"))) lbl.description = _('annually') xfer.add_component(lbl) elif self.item.subscriptiontype.duration == 1: # periodic sel = XferCompSelect('period') sel.set_needed(True) sel.set_select_query(season.period_set.all()) sel.set_location(1, row) sel.description = _('period') xfer.add_component(sel) elif self.item.subscriptiontype.duration == 2: # monthly sel = XferCompSelect('month') sel.set_needed(True) sel.set_select(season.get_months()) sel.set_location(1, row) sel.description = _('month') xfer.add_component(sel) elif self.item.subscriptiontype.duration == 3: # calendar begindate = XferCompDate('begin_date') begindate.set_needed(True) begindate.set_value(season.date_ref) begindate.set_location(1, row) begindate.description = _('begin date') xfer.add_component(begindate)
def fillresponse(self, begin_date, end_date): self.item.set_dates(begin_date, end_date) date_init = XferCompDate("begin_date") date_init.set_needed(True) date_init.set_value(self.item.date_begin) date_init.set_location(1, 0) date_init.description = _('initial date') date_init.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH) self.add_component(date_init) date_end = XferCompDate("end_date") date_end.set_needed(True) date_end.set_value(self.item.date_end) date_end.set_location(3, 0) date_end.description = _('current date') date_end.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH) self.add_component(date_end) XferShowEditor.fillresponse(self)
def edit(self, xfer): date = XferCompDate('begin_date') date.set_location(1, 0) date.set_needed(True) date.description = _('begin date') val = Period.objects.all().aggregate(Max('end_date')) if ('end_date__max' in val.keys()) and (val['end_date__max'] is not None): date.set_value(val['end_date__max'] + timedelta(days=1)) xfer.add_component(date)
def fillresponse(self, flt1=0.0, flt2=0, dt1='01-01-2010', tm1='12:00', stm1='01-01-2010 12:00'): act_modif = self.get_action('Modify', '') flt = XferCompFloat('flt1') flt.set_value(flt1) flt.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO) flt.set_location(0, 1) flt.needed = False flt.description = 'Real=' + six.text_type(flt1) self.add_component(flt) flt = XferCompFloat('flt2', 0, 100, 0) flt.set_value(flt2) flt.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO) flt.set_location(0, 2) flt.needed = False flt.description = 'Integer=' + six.text_type(flt2) self.add_component(flt) date = XferCompDate('dt1') date.set_value(dt1) date.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO) date.set_location(0, 3) date.needed = False date.description = 'Date=' + six.text_type(dt1) self.add_component(date) time = XferCompTime('tm1') time.set_value(tm1) time.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO) time.set_location(0, 4) time.needed = False time.description = 'Hour=' + six.text_type(tm1) self.add_component(time) datetime = XferCompDateTime('stm1') datetime.set_value(stm1) datetime.set_action(self.request, act_modif, modal=FORMTYPE_REFRESH, close=CLOSE_NO) datetime.set_location(0, 5) datetime.needed = False datetime.description = 'Date Hour=' + six.text_type(stm1) self.add_component(datetime)