Amélioration UC

- Ajout d'une liste des événements par lieu
- Correction de quelques défauts d'affichage
This commit is contained in:
Jean-Marie Favreau 2024-05-01 15:06:02 +02:00
parent 5b47af293c
commit 32201ecd43
7 changed files with 56 additions and 23 deletions

View File

@ -4,7 +4,7 @@
{% if event.is_single_day %}
{{ event.start_day |date:"l" }}<br />
<a href="{{ event.start_day | url_day }}?{{ filter.get_url }}"><span class="large">{{ event.start_day |date:"j" }}</span><br />
{{ event.start_day |date:"F" }}</a>
{{ event.start_day |date:"F" }}{% if with_year %} {{ event.start_day |date:"Y" }}{% endif %}</a>
{% if event.start_time %}
<footer>
<span class="large">{{ event.start_time }}</span>

View File

@ -0,0 +1,15 @@
<span>
{% if page_obj.has_previous %}
<a href="?page=1" role="button">&laquo; premier</a>
<a href="?page={{ page_obj.previous_page_number }}" role="button">précédent</a>
{% endif %}
<span>
Page {{ page_obj.number }} sur {{ page_obj.paginator.num_pages }}
</span>
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}" role="button">suivant</a>
<a href="?page={{ page_obj.paginator.num_pages }}" role="button">dernier &raquo;</a>
{% endif %}
</span>

View File

@ -27,8 +27,8 @@
{% endif %}
{% if perms.agenda_culturel.change_place %}
<div class="slide-buttons">
<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 'edit_place' object.pk %}" role="button">Modifier {% picto_from_name "edit-3" %}</a>
<a href="{% url 'delete_place' object.pk %}" role="button">Supprimer {% picto_from_name "trash-2" %}</a>
</div>
{% endif %}
<h1>{{ object.name }}</h1>
@ -58,6 +58,20 @@
</script>
</div>
</div>
{% if object_list %}
<h2>Événements</h2>
{% include "agenda_culturel/navigation.html" with page_obj=page_obj %}
{% for event in object_list %}
<article>
{% include "agenda_culturel/single-event/event-in-flat-list-inc.html" with event=event no_location=1 %}
</article>
{% endfor %}
{% include "agenda_culturel/navigation.html" with page_obj=page_obj %}
{% endif %}
<footer>
<!--p>Voir tous les événements de ce lieu</p-->
{% if user.is_authenticated %}

View File

@ -18,6 +18,8 @@
</div>
<h1>Lieux</h1>
</header>
{% include "agenda_culturel/navigation.html" with page_obj=page_obj %}
{% if object_list %}
{% for place in object_list %}
<article>
@ -50,21 +52,7 @@
<p>Il n'y a aucun lieu défini.</p>
{% endif %}
<footer>
<span>
{% if page_obj.has_previous %}
<a href="?page=1" role="button">&laquo; premier</a>
<a href="?page={{ page_obj.previous_page_number }}" role="button">précédent</a>
{% endif %}
<span>
Page {{ page_obj.number }} sur {{ page_obj.paginator.num_pages }}
</span>
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}" role="button">suivant</a>
<a href="?page={{ page_obj.paginator.num_pages }}" role="button">dernier &raquo;</a>
{% endif %}
</span>
{% include "agenda_culturel/navigation.html" with page_obj=page_obj %}
</footer>
</article>

View File

@ -11,9 +11,11 @@
{% include "agenda_culturel/date-times-inc.html" with event=event %}
</header>
<p class="subentry-search"></p>
{% picto_from_name "map-pin" %}
{% if event.location_hl %}{{ event.location_hl | safe }}{% else %}{% include "agenda_culturel/event-location-inc.html" with event=event %}{% endif %}</p>
{% if event.has_recurrences %}
{% if not no_location %}
{% picto_from_name "map-pin" %}
{% if event.location_hl %}{{ event.location_hl | safe }}{% else %}{% include "agenda_culturel/event-location-inc.html" with event=event %}{% endif %}</p>
{% endif %}
{% if event.has_recurrences %}
<p class="subentry-search">
{% picto_from_name "repeat" %}
<!-- TODO: see https://forge.chapril.org/jmtrivial/agenda_culturel/issues/65 -->
@ -26,6 +28,7 @@
{% endif %}
</p>
{% endif %}
{% if event.tags %}
<p class="subentry-search">
{% picto_from_name "tag" %}
{% for tag in event.tags %}
@ -33,6 +36,7 @@
{% if not forloop.last %}, {% endif %}
{% endfor %}
</p>
{% endif %}
<div class="description">
{% if event.description_hl %}{{ event.description_hl | safe }} [...]{% else %}{% if event.description %}{{ event.description |truncatewords:60 }}{% else %}<em>pas de description</em>{% endif %}{% endif %}

View File

@ -5,7 +5,7 @@
{% load tag_extra %}
<article>
{% include "agenda_culturel/ephemeris-inc.html" with event=event filter=filter %}
{% include "agenda_culturel/ephemeris-inc.html" with event=event filter=filter with_year=with_year %}
{{ event.category | small_cat_recurrent:event.has_recurrences }}
{% if event.location or event.exact_location %}<hgroup>{% endif %}

View File

@ -1126,8 +1126,20 @@ class PlaceListView(ListView):
ordering = ['name__unaccent']
class PlaceDetailView(DetailView):
class PlaceDetailView(ListView):
model = Place
template_name = "agenda_culturel/place_detail.html"
paginate_by = 10
def get_queryset(self):
self.place = get_object_or_404(Place, pk=self.kwargs['pk'])
return Event.objects.filter(exact_location=self.place).order_by("-start_day")
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['object'] = self.place
return context
class UpdatePlaces:
def form_valid(self, form):