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

Merge branch 'fix/562-newsletter-old-is_active' into 'master'

Removed usage of old is_active method in newsletters app

Closes #562

See merge request !681
parents 1120a287 e75d8283
...@@ -8,6 +8,7 @@ from django.test import TestCase ...@@ -8,6 +8,7 @@ from django.test import TestCase
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from members.models import Membership, Profile
from newsletters.models import Newsletter, NewsletterEvent from newsletters.models import Newsletter, NewsletterEvent
from newsletters.templatetags import listutil from newsletters.templatetags import listutil
...@@ -28,6 +29,13 @@ class NewslettersTest(TestCase): ...@@ -28,6 +29,13 @@ class NewslettersTest(TestCase):
email='jacob@test.com', email='jacob@test.com',
password='top_secret', password='top_secret',
is_staff=True) is_staff=True)
Profile.objects.create(user=cls.user,
address_street='street',
address_postal_code='1234AB',
address_city='city')
Membership.objects.create(type=Membership.MEMBER,
user=cls.user,
since=timezone.now())
cls.user.user_permissions.set( cls.user.user_permissions.set(
Permission.objects.filter(content_type__app_label="newsletters") Permission.objects.filter(content_type__app_label="newsletters")
......
...@@ -69,10 +69,10 @@ def admin_send(request, pk): ...@@ -69,10 +69,10 @@ def admin_send(request, pk):
translation.activate(language[0]) translation.activate(language[0])
recipients = [member.email for member in recipients = [member.email for member in
Member.objects.all().filter( Member.active_members.all().filter(
profile__receive_newsletter=True, profile__receive_newsletter=True,
profile__language=language[0]) profile__language=language[0])
if member.is_active() is True and member.email] if member.email]
subject = '[THALIA] ' + newsletter.title subject = '[THALIA] ' + newsletter.title
......
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