Unverified Commit 159928db authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

only include currently active committeemembers in mailing lists

parent 78944725
from django.core import validators
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from activemembers.models import Committee
......@@ -24,7 +25,8 @@ class MailingList(models.Model):
yield member.user.email
for committee in self.committees.all().prefetch_related("members"):
for member in committee.members.all():
for member in committee.members.exclude(
  • This should be

    for member in committee.members.exclude(committeemembership__until__lt=timezone.now().date()):

    From the error log:

    Internal Server Error: /mailinglists/
    FieldError at /mailinglists/
    Cannot resolve keyword 'commiteemembership' into field. Choices are: address_city, address_postal_code, address_street, address_street2, bank_account, birthday, committee, committeemembership, direct_debit_authorized, display_name_preference, emergency_contact, emergency_contact_phone_number, event_permissions, id, initials, language, mailinglist, mentorship, nickname, order, phone_number, photo, profile_description, programme, receive_newsletter, receive_optin, registration, show_birthday, starting_year, student_number, user, user_id, website
Please register or sign in to reply
yield member.user.email
for address in self.addresses.all():
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