From a5cb322f2ade47abed3b98e79dd8e16cf3235448 Mon Sep 17 00:00:00 2001 From: Piotr Banaszkiewicz Date: Mon, 7 Oct 2024 22:40:12 +0200 Subject: [PATCH] [#1992] Rename Host->Host Site, Sponsor->Organiser No migration created since the rename is only in forms and some templates. --- amy/templates/dashboard/admin_dashboard.html | 2 +- .../includes/event_details_table.html | 4 +-- amy/templates/workshops/all_events.html | 2 +- amy/templates/workshops/events_merge.html | 8 +++++- amy/workshops/forms.py | 27 ++++++++++++++++--- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/amy/templates/dashboard/admin_dashboard.html b/amy/templates/dashboard/admin_dashboard.html index f74c8d4e1..45bad47ce 100644 --- a/amy/templates/dashboard/admin_dashboard.html +++ b/amy/templates/dashboard/admin_dashboard.html @@ -49,7 +49,7 @@

In progress workshops

Dates Location URL - Host + Host Site {% for event in unpublished_events %} diff --git a/amy/templates/includes/event_details_table.html b/amy/templates/includes/event_details_table.html index 555a4fb69..eb13f8c11 100644 --- a/amy/templates/includes/event_details_table.html +++ b/amy/templates/includes/event_details_table.html @@ -8,8 +8,8 @@ Completed:{{ event.completed|yesno }} Start date:{{ event.start|default:"—" }} End date: {{ event.end|default:"—" }} - Host:{{ event.host }} - Sponsor:{% if event.sponsor %}{{ event.sponsor }}{% else %}—{% endif %} + Host Site:{{ event.host }} + Organiser:{% if event.sponsor %}{{ event.sponsor }}{% else %}—{% endif %} Membership:{% if event.membership %}{{ event.membership }}{% else %}—{% endif %} Administrator:{% if event.administrator %}{{ event.administrator }}{% else %}—{% endif %} Is this workshop public?
Public workshops will show up in public Carpentries feeds.{{ event.get_public_status_display|default:"—" }} diff --git a/amy/templates/workshops/all_events.html b/amy/templates/workshops/all_events.html index b91e86659..173e5b976 100644 --- a/amy/templates/workshops/all_events.html +++ b/amy/templates/workshops/all_events.html @@ -18,7 +18,7 @@ Tags URL Instructors - Host + Host Site Dates Completed diff --git a/amy/templates/workshops/events_merge.html b/amy/templates/workshops/events_merge.html index d73646704..9be9ef4c0 100644 --- a/amy/templates/workshops/events_merge.html +++ b/amy/templates/workshops/events_merge.html @@ -49,11 +49,17 @@ {% include "includes/merge_radio.html" with field=form.end %} - Host + Host Site {{ obj_a.host }} {{ obj_b.host }} {% include "includes/merge_radio.html" with field=form.host %} + + Organiser + {{ obj_a.sponsor }} + {{ obj_b.sponsor }} + {% include "includes/merge_radio.html" with field=form.sponsor %} + Administrator {% if obj_a.administrator %}{{ obj_a.administrator }}{% else %}—{% endif %} diff --git a/amy/workshops/forms.py b/amy/workshops/forms.py index 4b828322c..6050273d7 100644 --- a/amy/workshops/forms.py +++ b/amy/workshops/forms.py @@ -372,6 +372,23 @@ class BulkUploadCSVForm(forms.Form): class EventForm(forms.ModelForm): + host = forms.ModelChoiceField( + label="Host Site", + required=True, + help_text=Event._meta.get_field("host").help_text, + queryset=Organization.objects.all(), + widget=ModelSelect2Widget(data_view="organization-lookup"), + ) + + sponsor = forms.ModelChoiceField( + label="Organiser", + required=True, + help_text=Event._meta.get_field("sponsor").help_text + + " Previously called 'Sponsor'.", + queryset=Organization.objects.all(), + widget=ModelSelect2Widget(data_view="organization-lookup"), + ) + administrator = forms.ModelChoiceField( label="Administrator", required=True, @@ -450,8 +467,6 @@ class Meta: "comment", ] widgets = { - "host": ModelSelect2Widget(data_view="organization-lookup"), - "sponsor": ModelSelect2Widget(data_view="organization-lookup"), "membership": ModelSelect2Widget(data_view="membership-lookup"), "manual_attendance": TextInput, "latitude": TextInput, @@ -1146,8 +1161,12 @@ class EventsMergeForm(forms.Form): ) start = forms.ChoiceField(choices=TWO, initial=DEFAULT, widget=forms.RadioSelect) end = forms.ChoiceField(choices=TWO, initial=DEFAULT, widget=forms.RadioSelect) - host = forms.ChoiceField(choices=TWO, initial=DEFAULT, widget=forms.RadioSelect) - sponsor = forms.ChoiceField(choices=TWO, initial=DEFAULT, widget=forms.RadioSelect) + host = forms.ChoiceField( + choices=TWO, initial=DEFAULT, widget=forms.RadioSelect, label="Host Site" + ) + sponsor = forms.ChoiceField( + choices=TWO, initial=DEFAULT, widget=forms.RadioSelect, label="Organiser" + ) administrator = forms.ChoiceField( choices=TWO, initial=DEFAULT,