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