From 811809895e2cab0722e9508df7815ff0e951bcbb Mon Sep 17 00:00:00 2001 From: Bartuccio Antoine Date: Wed, 16 Oct 2019 21:21:06 +0200 Subject: [PATCH] club: fix mailing list form that unexpectedly relied on try catch in permissions --- club/tests.py | 7 ++++++- club/views.py | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/club/tests.py b/club/tests.py index 2536390e..33e6016e 100644 --- a/club/tests.py +++ b/club/tests.py @@ -641,7 +641,7 @@ class MailingFormTest(TestCase): {"action": MailingForm.ACTION_NEW_MAILING, "mailing_email": "mde"}, ) mde = Mailing.objects.get(email="mde") - response = self.client.post( + self.client.post( reverse("club:mailing", kwargs={"club_id": self.bdf.id}), { "action": MailingForm.ACTION_NEW_SUBSCRIPTION, @@ -650,6 +650,11 @@ class MailingFormTest(TestCase): "subscription_mailing": mde.id, }, ) + + response = self.client.get( + reverse("club:mailing", kwargs={"club_id": self.bdf.id}) + ) + self.assertContains(response, "comunity@git.an") self.assertContains(response, "richard@git.an") self.assertContains(response, "krophil@git.an") diff --git a/club/views.py b/club/views.py index da9824e2..a5b3aef8 100644 --- a/club/views.py +++ b/club/views.py @@ -574,7 +574,8 @@ class ClubMailingView(ClubTabsMixin, CanEditMixin, DetailFormView): except ValidationError as validation_error: return validation_error - users_to_save.append(sub.save()) + sub.save() + users_to_save.append(sub) if cleaned_data["subscription_email"]: sub = MailingSubscription(