From 6232227566c69738359e18a885fabc76cdb3a4de Mon Sep 17 00:00:00 2001
From: Jorran de Wit <jorrandewit@outlook.com>
Date: Tue, 27 Jun 2017 19:29:23 +0200
Subject: [PATCH] Remove Contact-types check from PromotionForm

---
 partners/forms.py | 26 --------------------------
 partners/utils.py |  7 +++----
 2 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/partners/forms.py b/partners/forms.py
index fd433f3de..37085e556 100644
--- a/partners/forms.py
+++ b/partners/forms.py
@@ -405,32 +405,6 @@ class PromoteToContactFormset(forms.BaseModelFormSet):
     This is a formset to process multiple `PromoteToContactForm`s at the same time
     designed for the 'promote prospect to partner' action.
     """
-    def clean(self):
-        """
-        Check if all CONTACT_TYPES are assigned to at least one contact.
-        """
-        contact_type_keys = list(dict(CONTACT_TYPES).keys())
-        for form in self.forms:
-            try:
-                contact_types = form.cleaned_data['contact_types']
-            except KeyError:
-                # Form invalid for `contact_types`
-                continue
-
-            for _type in contact_types:
-                try:
-                    contact_type_keys.remove(_type)
-                except ValueError:
-                    # Type-key already removed
-                    continue
-            if not contact_type_keys:
-                break
-        if contact_type_keys:
-            # Add error to all forms if not all CONTACT_TYPES are assigned
-            for form in self.forms:
-                form.add_error('contact_types', ("Not all contact types have been"
-                                                 " divided over the contacts yet."))
-
     def save(self, *args, **kwargs):
         raise DeprecationWarning(("This formset is not meant to used with the default"
                                   " `save` method. User the `promote_contacts` instead."))
diff --git a/partners/utils.py b/partners/utils.py
index aade17e1d..2289c704f 100644
--- a/partners/utils.py
+++ b/partners/utils.py
@@ -1,7 +1,6 @@
 from common.utils import BaseMailUtil
 
 
-
 class PartnerUtils(BaseMailUtil):
     mail_sender = 'partners@scipost.org'
     mail_sender_title = 'SciPost Supporting Partners'
@@ -14,8 +13,8 @@ class PartnerUtils(BaseMailUtil):
         and invite participation to the Supporting Partners Board.
         """
         cls._send_mail(cls, 'email_prospartner_contact',
-                       [cls._context['contact'].email,],
-                        cls._context['email_subject'])
+                       [cls._context['contact'].email],
+                       cls._context['email_subject'])
 
     @classmethod
     def email_prospartner_generic(cls):
@@ -24,5 +23,5 @@ class PartnerUtils(BaseMailUtil):
         for which no Contact could be defined.
         """
         cls._send_mail(cls, 'email_prospartner_contact',
-                       [cls._context['email'],],
+                       [cls._context['email']],
                        cls._context['email_subject'])
-- 
GitLab