diff --git a/report/forms.py b/report/forms.py index 614aeb2..33c2826 100644 --- a/report/forms.py +++ b/report/forms.py @@ -80,6 +80,20 @@ def clean_organizers(self): organizers.append(organizer_object) return organizers + def clean_partners_activated(self): + organizers_string = self.data.get("organizers_string", "") + organizers_list = organizers_string.split("\r\n") if organizers_string else [] + + partners = self.data.getlist("partners_activated", []) if "partners_activated" in self.data else [] + for organizer in organizers_list: + organizer_name, institution_name = (organizer + ";").split(";", maxsplit=1) + if institution_name: + for partner_name in institution_name.split(";"): + if partner_name: + partner, partner_created = Partner.objects.get_or_create(name=partner_name.strip()) + partners.append(partner.id) + return partners + def clean_initial_date(self): initial_date = self.cleaned_data.get('initial_date') return initial_date diff --git a/report/templates/report/quantitative.html b/report/templates/report/quantitative.html index 6a2d022..4a9a096 100644 --- a/report/templates/report/quantitative.html +++ b/report/templates/report/quantitative.html @@ -42,7 +42,7 @@