diff --git a/src/agenda_culturel/forms.py b/src/agenda_culturel/forms.py index a38498e..3385f73 100644 --- a/src/agenda_culturel/forms.py +++ b/src/agenda_culturel/forms.py @@ -885,6 +885,9 @@ class EventAddPlaceForm(Form): ).format(self.instance.location) else: self.fields.pop("add_alias") + if self.instance.exact_location: + self.fields["place"].initial = self.instance.exact_location + self.fields["add_alias"].initial = False def modified_event(self): return self.cleaned_data.get("place") diff --git a/src/agenda_culturel/templates/agenda_culturel/place_unknown_form.html b/src/agenda_culturel/templates/agenda_culturel/event_set_place_form.html similarity index 90% rename from src/agenda_culturel/templates/agenda_culturel/place_unknown_form.html rename to src/agenda_culturel/templates/agenda_culturel/event_set_place_form.html index ef6e009..191d172 100644 --- a/src/agenda_culturel/templates/agenda_culturel/place_unknown_form.html +++ b/src/agenda_culturel/templates/agenda_culturel/event_set_place_form.html @@ -1,7 +1,14 @@ {% extends "agenda_culturel/page.html" %} {% load static %} {% block title %} - {% block og_title %}Ajouter un lieu à {{ object.title }}{% endblock %} + {% block og_title %} + {% if object.exact_location %} + Modifier le lieu de + {% else %} + Ajouter un lieu à + {% endif %} + {{ object.title }} + {% endblock %} {% endblock %} {% load cat_extra %} {% block entete_header %} @@ -26,7 +33,14 @@ {% load static_content_extra %}
-

Ajouter un lieu à {{ object.title }} ({{ object.start_day }})

+

+ {% if object.exact_location %} + Modifier le lieu de + {% else %} + Ajouter un lieu à + {% endif %} + {{ object.title }} ({{ object.start_day }}) +

Si le lieu est disponible dans la liste déroulante, sélectionne-le. S'il n'est pas disponible, utilise diff --git a/src/agenda_culturel/templates/agenda_culturel/page-week.html b/src/agenda_culturel/templates/agenda_culturel/page-week.html index 8591698..200db44 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-week.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-week.html @@ -168,7 +168,7 @@ {{ event.exact_location.name }}, {{ event.exact_location.city }} {% else %} {% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %} - {{ event.location }} + {{ event.location }} {% else %} {{ event.location }} {% endif %} diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html index ec50fb0..ff596c1 100644 --- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-elegant-inc.html @@ -40,7 +40,7 @@ {{ event.exact_location.name }}, {{ event.exact_location.city }} {% else %} {% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %} - {{ event.location }} + {{ event.location }} {% else %} {{ event.location }} {% endif %} diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html index 558ce28..8cf02ee 100644 --- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-flat-list-inc.html @@ -50,7 +50,7 @@ {{ event.exact_location.name }}, {{ event.exact_location.city }} {% else %} {% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %} - {{ event.location }} + {{ event.location }} {% else %} {{ event.location }} {% endif %} diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-unknown-place-list-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-unknown-place-list-inc.html index 40bdbf1..8cc245c 100644 --- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-unknown-place-list-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-in-unknown-place-list-inc.html @@ -5,7 +5,7 @@

@@ -20,7 +20,7 @@ {{ event.exact_location.name }}, {{ event.exact_location.city }} {% else %} {% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %} - {{ event.location }} + {{ event.location }} {% else %} {{ event.location }} {% endif %} diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html index 9b0d4ac..2bb3262 100644 --- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html @@ -87,12 +87,15 @@

{% picto_from_name "map-pin" %} {{ event.exact_location.name }}, {{ event.exact_location.city }} + {% if user.is_authenticated %} + (modifier) + {% endif %}

{% else %} {% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %}

{% picto_from_name "map-pin" %} - + {% if event.location %} {{ event.location }} {% else %} diff --git a/src/agenda_culturel/urls.py b/src/agenda_culturel/urls.py index cd79421..5adcf22 100644 --- a/src/agenda_culturel/urls.py +++ b/src/agenda_culturel/urls.py @@ -473,9 +473,9 @@ urlpatterns = [ path("places/", PlaceListView.as_view(), name="view_places"), path("place//edit", PlaceUpdateView.as_view(), name="edit_place"), path( - "event//addplace", + "event//setplace", UnknownPlaceAddView.as_view(), - name="add_place_to_event", + name="set_place_to_event", ), path( "events/unknown-places", diff --git a/src/agenda_culturel/views/places_views.py b/src/agenda_culturel/views/places_views.py index 3f82660..6e08ae7 100644 --- a/src/agenda_culturel/views/places_views.py +++ b/src/agenda_culturel/views/places_views.py @@ -181,7 +181,7 @@ class UnknownPlaceAddView(PermissionRequiredMixin, SuccessMessageMixin, UpdateVi "agenda_culturel.change_event", ) form_class = EventAddPlaceForm - template_name = "agenda_culturel/place_unknown_form.html" + template_name = "agenda_culturel/event_set_place_form.html" def form_valid(self, form): self.modified_event = form.cleaned_data.get("place")