parent
a3b20bc3f6
commit
0d4d6b5e9b
@ -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")
|
||||
|
@ -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 %}
|
||||
<article>
|
||||
<header>
|
||||
<h1>Ajouter un lieu à {{ object.title }} ({{ object.start_day }})</h1>
|
||||
<h1>
|
||||
{% if object.exact_location %}
|
||||
Modifier le lieu de
|
||||
{% else %}
|
||||
Ajouter un lieu à
|
||||
{% endif %}
|
||||
{{ object.title }} ({{ object.start_day }})
|
||||
</h1>
|
||||
</header>
|
||||
<p>
|
||||
Si le lieu est disponible dans la liste déroulante, sélectionne-le. S'il n'est pas disponible, utilise
|
@ -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 %}
|
||||
<a href="{% url 'add_place_to_event' event.pk %}" class="missing-data">{{ event.location }}</a>
|
||||
<a href="{% url 'set_place_to_event' event.pk %}" class="missing-data">{{ event.location }}</a>
|
||||
{% else %}
|
||||
{{ event.location }}
|
||||
{% endif %}
|
||||
|
@ -40,7 +40,7 @@
|
||||
<a href="{{ event.exact_location.get_absolute_url }}">{{ event.exact_location.name }}, {{ event.exact_location.city }}</a>
|
||||
{% else %}
|
||||
{% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %}
|
||||
<a href="{% url 'add_place_to_event' event.pk %}" class="missing-data">{{ event.location }}</a>
|
||||
<a href="{% url 'set_place_to_event' event.pk %}" class="missing-data">{{ event.location }}</a>
|
||||
{% else %}
|
||||
{{ event.location }}
|
||||
{% endif %}
|
||||
|
@ -50,7 +50,7 @@
|
||||
<a href="{{ event.exact_location.get_absolute_url }}">{{ event.exact_location.name }}, {{ event.exact_location.city }}</a>
|
||||
{% else %}
|
||||
{% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %}
|
||||
<a href="{% url 'add_place_to_event' event.pk %}" class="missing-data">{{ event.location }}</a>
|
||||
<a href="{% url 'set_place_to_event' event.pk %}" class="missing-data">{{ event.location }}</a>
|
||||
{% else %}
|
||||
{{ event.location }}
|
||||
{% endif %}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<header>
|
||||
<div class="slide-buttons">
|
||||
<div class="buttons">
|
||||
<a href="{% url 'add_place_to_event' event.pk %}" role="button">Ajouter le lieu {% picto_from_name "map-pin" %}</a>
|
||||
<a href="{% url 'set_place_to_event' event.pk %}" role="button">Ajouter le lieu {% picto_from_name "map-pin" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
<h3>
|
||||
@ -20,7 +20,7 @@
|
||||
<a href="{{ event.exact_location.get_absolute_url }}">{{ event.exact_location.name }}, {{ event.exact_location.city }}</a>
|
||||
{% else %}
|
||||
{% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %}
|
||||
<a href="{% url 'add_place_to_event' event.pk %}" class="missing-data">{{ event.location }}</a>
|
||||
<a href="{% url 'set_place_to_event' event.pk %}" class="missing-data">{{ event.location }}</a>
|
||||
{% else %}
|
||||
{{ event.location }}
|
||||
{% endif %}
|
||||
|
@ -87,12 +87,15 @@
|
||||
<p>
|
||||
{% picto_from_name "map-pin" %}
|
||||
<a href="{{ event.exact_location.get_absolute_url }}">{{ event.exact_location.name }}, {{ event.exact_location.city }}</a>
|
||||
{% if user.is_authenticated %}
|
||||
(<a href="{% url 'set_place_to_event' event.pk %}">modifier</a>)
|
||||
{% endif %}
|
||||
</p>
|
||||
{% else %}
|
||||
{% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %}
|
||||
<p>
|
||||
{% picto_from_name "map-pin" %}
|
||||
<a href="{% url 'add_place_to_event' event.pk %}" class="missing-data">
|
||||
<a href="{% url 'set_place_to_event' event.pk %}" class="missing-data">
|
||||
{% if event.location %}
|
||||
{{ event.location }}
|
||||
{% else %}
|
||||
|
@ -473,9 +473,9 @@ urlpatterns = [
|
||||
path("places/", PlaceListView.as_view(), name="view_places"),
|
||||
path("place/<int:pk>/edit", PlaceUpdateView.as_view(), name="edit_place"),
|
||||
path(
|
||||
"event/<int:pk>/addplace",
|
||||
"event/<int:pk>/setplace",
|
||||
UnknownPlaceAddView.as_view(),
|
||||
name="add_place_to_event",
|
||||
name="set_place_to_event",
|
||||
),
|
||||
path(
|
||||
"events/unknown-places",
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user