Show start/end date as separte fields for CORE Member view
This commit is contained in:
parent
efab515880
commit
7a50a03d14
|
@ -50,7 +50,7 @@ class MemberTypeView(CoreOfficeMasterView):
|
|||
}
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(MemberTypeView, self).configure_grid(g)
|
||||
super().configure_grid(g)
|
||||
|
||||
g.set_link('id')
|
||||
g.set_link('description')
|
||||
|
@ -99,7 +99,8 @@ class MemberView(CoreOfficeMasterView):
|
|||
'email',
|
||||
'email2',
|
||||
'ads_ok',
|
||||
'dates',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'barcodes',
|
||||
'suspension',
|
||||
'equity_live_balance',
|
||||
|
@ -122,7 +123,7 @@ class MemberView(CoreOfficeMasterView):
|
|||
]
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(MemberView, self).configure_grid(g)
|
||||
super().configure_grid(g)
|
||||
|
||||
g.set_sort_defaults('card_number')
|
||||
|
||||
|
@ -134,9 +135,11 @@ class MemberView(CoreOfficeMasterView):
|
|||
g.set_link('last_name')
|
||||
|
||||
def configure_form(self, f):
|
||||
super(MemberView, self).configure_form(f)
|
||||
super().configure_form(f)
|
||||
|
||||
f.set_renderer('dates', self.render_member_dates)
|
||||
# dates
|
||||
f.set_renderer('start_date', self.render_member_date)
|
||||
f.set_renderer('end_date', self.render_member_date)
|
||||
|
||||
f.set_renderer('barcodes', self.render_barcodes)
|
||||
|
||||
|
@ -147,14 +150,10 @@ class MemberView(CoreOfficeMasterView):
|
|||
|
||||
f.set_renderer('equity_live_balance', self.render_equity_live_balance)
|
||||
|
||||
def render_member_dates(self, member, field):
|
||||
if not member.dates:
|
||||
return ""
|
||||
|
||||
items = []
|
||||
for dates in member.dates:
|
||||
items.append(HTML.tag('li', c=str(dates)))
|
||||
return HTML.tag('ul', c=items)
|
||||
def render_member_date(self, member, field):
|
||||
date = getattr(member.dates, field)
|
||||
if date:
|
||||
return str(date.date())
|
||||
|
||||
def render_barcodes(self, member, field):
|
||||
barcodes = member.barcodes
|
||||
|
|
Loading…
Reference in a new issue