On améliore les urls des lieux pour le référencement
This commit is contained in:
parent
ac98b4c845
commit
2478a671bf
@ -332,7 +332,7 @@ class Place(models.Model):
|
|||||||
return self.name + ", " + self.city
|
return self.name + ", " + self.city
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse("view_place", kwargs={"pk": self.pk})
|
return reverse("view_place_fullname", kwargs={"pk": self.pk, "extra": slugify(self.name)})
|
||||||
|
|
||||||
def nb_events(self):
|
def nb_events(self):
|
||||||
return Event.objects.filter(exact_location=self).count()
|
return Event.objects.filter(exact_location=self).count()
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
{% if nolink %}
|
{% if nolink %}
|
||||||
{{ event.exact_location.name }}, {{ event.exact_location.city }}
|
{{ event.exact_location.name }}, {{ event.exact_location.city }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{% url 'view_place' event.exact_location.pk %}">{{ event.exact_location.name }}, {{ event.exact_location.city }}</a>
|
<a href="{{ event.exact_location.get_absolute_url }}">{{ event.exact_location.name }}, {{ event.exact_location.city }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %}
|
{% if perms.agenda_culturel.change_event and perms.agenda_culturel.change_place %}
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
{% cache cache_timeout place_list user.is_authenticated object page_obj.number past %}
|
{% cache cache_timeout place_list user.is_authenticated object page_obj.number past %}
|
||||||
<div class="slide-buttons">
|
<div class="slide-buttons">
|
||||||
{% if past %}
|
{% if past %}
|
||||||
<a href="{% url 'view_place' object.pk %}" role="button">Voir les événements à venir</a>
|
<a href="{{ object.get_absolute_url }}" role="button">Voir les événements à venir</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{% url 'view_place_past' object.pk %}" role="button">Voir les événements passés</a>
|
<a href="{% url 'view_place_past' object.pk %}" role="button">Voir les événements passés</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
{% if object_list %}
|
{% if object_list %}
|
||||||
{% for place in object_list %}
|
{% for place in object_list %}
|
||||||
<h3><a href="{% url 'view_place' place.pk %}">{{ place.name }}</a> — <a id="open-map-{{ place.id }}" href="#map_location" data-tooltip="afficher sur la carte">{% picto_from_name "map" %}</a></h3>
|
<h3><a href="{{ place.get_absolute_url }}">{{ place.name }}</a> — <a id="open-map-{{ place.id }}" href="#map_location" data-tooltip="afficher sur la carte">{% picto_from_name "map" %}</a></h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>Adresse :</strong> {% if place.address %}{{ place.address }}, {% endif %}{{ place.city }}</li>
|
<li><strong>Adresse :</strong> {% if place.address %}{{ place.address }}, {% endif %}{{ place.city }}</li>
|
||||||
<li><strong>Coordonnée GPS :</strong> {{ place.location }}</li>
|
<li><strong>Coordonnée GPS :</strong> {{ place.location }}</li>
|
||||||
@ -74,7 +74,7 @@
|
|||||||
window.mMapping = {};
|
window.mMapping = {};
|
||||||
{% if object_list %}
|
{% if object_list %}
|
||||||
{% for place in object_list %}
|
{% for place in object_list %}
|
||||||
markerArray.push(L.marker([{{ place.location|tocoords }}]).bindPopup('<a href="{% url 'view_place' place.pk %}">{{ place.name }}</a><br />{% if place.address %}{{ place.address }}, {% endif %}{{ place.city }}'))
|
markerArray.push(L.marker([{{ place.location|tocoords }}]).bindPopup('<a href="{{ place.get_absolute_url }}">{{ place.name }}</a><br />{% if place.address %}{{ place.address }}, {% endif %}{{ place.city }}'))
|
||||||
markers.addLayer(markerArray[markerArray.length - 1]);
|
markers.addLayer(markerArray[markerArray.length - 1]);
|
||||||
window.mMapping[{{ place.id }}] = markerArray[markerArray.length - 1];
|
window.mMapping[{{ place.id }}] = markerArray[markerArray.length - 1];
|
||||||
window.jQuery('a#open-map-{{ place.id }}').click(function(){
|
window.jQuery('a#open-map-{{ place.id }}').click(function(){
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<div class="slide-buttons">
|
<div class="slide-buttons">
|
||||||
<a href="{% url 'view_place' place.pk %}" role="button">Consulter {% picto_from_name "eye" %}</a>
|
<a href="{{ place.get_absolute_url }}" role="button">Consulter {% picto_from_name "eye" %}</a>
|
||||||
<a href="{% url 'edit_place' place.pk %}" role="button">Modifier {% picto_from_name "edit-3" %}</a>
|
<a href="{% url 'edit_place' place.pk %}" role="button">Modifier {% picto_from_name "edit-3" %}</a>
|
||||||
<a href="{% url 'delete_place' place.pk %}" role="button">Supprimer {% picto_from_name "trash-2" %}</a>
|
<a href="{% url 'delete_place' place.pk %}" role="button">Supprimer {% picto_from_name "trash-2" %}</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -154,6 +154,8 @@ urlpatterns = [
|
|||||||
path("500/", internal_server_error, name="internal_server_error"),
|
path("500/", internal_server_error, name="internal_server_error"),
|
||||||
path("place/<int:pk>/past", PlaceDetailViewPast.as_view(), name="view_place_past"),
|
path("place/<int:pk>/past", PlaceDetailViewPast.as_view(), name="view_place_past"),
|
||||||
path("place/<int:pk>", PlaceDetailView.as_view(), name="view_place"),
|
path("place/<int:pk>", PlaceDetailView.as_view(), name="view_place"),
|
||||||
|
path("place/<int:pk>-<extra>/past", PlaceDetailViewPast.as_view(), name="view_place_past_fullname"),
|
||||||
|
path("place/<int:pk>-<extra>", PlaceDetailView.as_view(), name="view_place_fullname"),
|
||||||
path("place/<int:pk>/edit", PlaceUpdateView.as_view(), name="edit_place"),
|
path("place/<int:pk>/edit", PlaceUpdateView.as_view(), name="edit_place"),
|
||||||
path("place/<int:pk>/delete", PlaceDeleteView.as_view(), name="delete_place"),
|
path("place/<int:pk>/delete", PlaceDeleteView.as_view(), name="delete_place"),
|
||||||
path("places/", PlaceListView.as_view(), name="view_places"),
|
path("places/", PlaceListView.as_view(), name="view_places"),
|
||||||
|
Loading…
Reference in New Issue
Block a user