def get_title_tags(self, ar): for t in super(ContractBaseTable, self).get_title_tags(ar): yield t pv = ar.param_values if pv.start_date is None or pv.end_date is None: pass else: oe = pv.observed_event if oe is not None: yield "%s %s-%s" % (unicode(oe.text), dd.dtos(pv.start_date), dd.dtos(pv.end_date)) if pv.company: yield unicode(pv.company)
def __str__(self): s = dd.dtos(self.start_date) if self.title: s += " " + self.title if self.offer: s += " " + unicode(self.offer) return s
def get_title_tags(self, ar): for t in super(NewClients, self).get_title_tags(ar): yield t pv = ar.param_values if pv.new_since: yield unicode(self.parameters['new_since'].verbose_name) \ + ' ' + dtos(pv.new_since)
def summary_row(self, ar, **kw): elems = list(super(StartedSummaryDescription, self) .summary_row(ar, **kw)) if self.summary: elems.append(': %s' % self.summary) elems += [_(" on "), dd.dtos(self.start_date)] return elems
def eid_info(self, ar): "Display some information about the eID card." if ar is None: return '' must_read = False attrs = dict(class_="lino-info") elems = [] if self.card_number: elems += [ "%s %s (%s)" % (ugettext("Card no."), self.card_number, self.card_type) ] if self.card_issuer: elems.append(", %s %s" % (ugettext("issued by"), self.card_issuer)) #~ card_issuer = _("issued by"), if self.card_valid_until is not None: valid = ", %s %s %s %s" % ( ugettext("valid from"), dd.dtos(self.card_valid_from), ugettext("until"), dd.dtos(self.card_valid_until)) if self.card_valid_until < dd.today(): must_read = True elems.append(E.b(valid)) elems.append(E.br()) else: elems.append(valid) else: must_read = True else: must_read = True if must_read: msg = _("Must read eID card!") if config: elems.append( ar.instance_action_button(self.read_beid, msg, icon_name=None)) else: elems.append(msg) # same red as in lino.css for .x-grid3-row-red td # ~ attrs.update(style="background-color:#FA7F7F; padding:3pt;") attrs.update(class_="lino-info-red") return E.div(*elems, **attrs)
def eid_info(self, ar): "Display some information about the eID card." attrs = {'class':"lino-info"} if ar is None: return E.div(**attrs) must_read = False elems = [] if self.card_number: elems += ["%s %s (%s)" % (ugettext("Card no."), self.card_number, self.card_type)] if self.card_issuer: elems.append(", %s %s" % (ugettext("issued by"), self.card_issuer)) #~ card_issuer = _("issued by"), if self.card_valid_until is not None: valid = ", %s %s %s %s" % ( ugettext("valid from"), dd.dtos(self.card_valid_from), ugettext("until"), dd.dtos(self.card_valid_until)) if self.card_valid_until < dd.today(): must_read = True elems.append(E.b(valid)) elems.append(E.br()) else: elems.append(valid) else: must_read = True else: must_read = True if must_read: msg = _("Must read eID card!") if dd.plugins.beid: elems.append(ar.instance_action_button( self.read_beid, msg, icon_name=None)) else: elems.append(msg) # same red as in lino.css for .x-grid3-row-red td # ~ attrs.update(style="background-color:#FA7F7F; padding:3pt;") attrs['class'] = "lino-info-red" return E.div(*elems, **attrs)
def daterange_text(a, b): """ """ if a == b: return dd.dtos(a) return dd.dtos(a) + "-" + dd.dtos(b)