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
|
||||
|
||||
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):
|
||||
return Event.objects.filter(exact_location=self).count()
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% if nolink %}
|
||||
{{ event.exact_location.name }}, {{ event.exact_location.city }}
|
||||
{% 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 %}
|
||||
{% else %}
|
||||
{% 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 %}
|
||||
<div class="slide-buttons">
|
||||
{% 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 %}
|
||||
<a href="{% url 'view_place_past' object.pk %}" role="button">Voir les événements passés</a>
|
||||
{% endif %}
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
{% if 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>
|
||||
<li><strong>Adresse :</strong> {% if place.address %}{{ place.address }}, {% endif %}{{ place.city }}</li>
|
||||
<li><strong>Coordonnée GPS :</strong> {{ place.location }}</li>
|
||||
@ -74,7 +74,7 @@
|
||||
window.mMapping = {};
|
||||
{% if 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]);
|
||||
window.mMapping[{{ place.id }}] = markerArray[markerArray.length - 1];
|
||||
window.jQuery('a#open-map-{{ place.id }}').click(function(){
|
||||
|
@ -31,7 +31,7 @@
|
||||
<article>
|
||||
<header>
|
||||
<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 'delete_place' place.pk %}" role="button">Supprimer {% picto_from_name "trash-2" %}</a>
|
||||
</div>
|
||||
|
@ -154,6 +154,8 @@ urlpatterns = [
|
||||
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>", 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>/delete", PlaceDeleteView.as_view(), name="delete_place"),
|
||||
path("places/", PlaceListView.as_view(), name="view_places"),
|
||||
|
Loading…
Reference in New Issue
Block a user