Commit a146452e authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'fix/mailinglists-user-member' into 'master'

Remove old prefetches from the mailinglists

See merge request !664
parents f59ca0b5 87aad163
......@@ -10,14 +10,14 @@ def get_automatic_lists():
memberships = (CommitteeMembership.active_memberships
committee_chairs = [x.member for x in memberships] + [
active_committee_memberships = (CommitteeMembership.active_memberships
active_members = [x.member for x in active_committee_memberships]
lectureyear = datetime_to_lectureyear(
......@@ -32,13 +32,13 @@ def get_automatic_lists():
lists += _create_automatic_list(
['leden', 'members'], '[THALIA]',
Member.all_with_membership('member', 'user'), True, True, True)
Member.all_with_membership('member'), True, True, True)
lists += _create_automatic_list(
['begunstigers', 'supporters'], '[THALIA]', Member.all_with_membership(
'supporter', 'user'), multilingual=True)
'supporter'), multilingual=True)
lists += _create_automatic_list(
['ereleden', 'honorary'], '[THALIA]', Member.all_with_membership(
'honorary', 'user'), multilingual=True)
'honorary'), multilingual=True)
lists += _create_automatic_list(
['mentors'], '[THALIA] [MENTORS]', mentors, moderated=False)
lists += _create_automatic_list(
......@@ -109,8 +109,8 @@ class Member(User):
_('Is this user currently active')
def all_with_membership(cls, membership_type, prefetch=None):
return [x for x in cls.objects.all().prefetch_related(prefetch)
def all_with_membership(cls, membership_type):
return [x for x in cls.objects.all()
if x.current_membership and
x.current_membership.type == membership_type]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment