Fix some things for viewing a member
This commit is contained in:
parent
b6cb119e89
commit
9572fbf584
|
@ -24,6 +24,8 @@
|
|||
Member Views
|
||||
"""
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from rattail.db import model
|
||||
|
@ -90,6 +92,11 @@ class MembershipTypeView(MasterView):
|
|||
g.filters['active'].default_active = True
|
||||
g.filters['active'].default_verb = 'is_true'
|
||||
|
||||
g.set_link('person')
|
||||
|
||||
def row_view_action_url(self, member, i):
|
||||
return self.request.route_url('members.view', uuid=member.uuid)
|
||||
|
||||
|
||||
class MemberView(MasterView):
|
||||
"""
|
||||
|
@ -284,18 +291,17 @@ class MemberView(MasterView):
|
|||
|
||||
def template_kwargs_view(self, **kwargs):
|
||||
kwargs = super().template_kwargs_view(**kwargs)
|
||||
app = self.get_rattail_app()
|
||||
member = kwargs['instance']
|
||||
|
||||
people = OrderedDict()
|
||||
if member.person:
|
||||
person = member.person
|
||||
person = app.get_person(member)
|
||||
if person:
|
||||
people.setdefault(person.uuid, person)
|
||||
if member.customer:
|
||||
customer = member.customer
|
||||
if customer.account_holder:
|
||||
person = customer.account_holder
|
||||
people.setdefault(person.uuid, person)
|
||||
for person in customer.people:
|
||||
customer = app.get_customer(member)
|
||||
if customer:
|
||||
person = app.get_person(customer)
|
||||
if person:
|
||||
people.setdefault(person.uuid, person)
|
||||
kwargs['show_profiles_people'] = list(people.values())
|
||||
|
||||
|
|
Loading…
Reference in a new issue