Always list all years in archive views
This commit is contained in:
parent
3afbc2b7e1
commit
f29719ef78
3 changed files with 30 additions and 19 deletions
|
|
@ -9,9 +9,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
{% block title %}{% blocktrans with show_year=year|date:"Y" %}Galleries for {{ show_year }}{% endblocktrans %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<aside class="col-md-2">
|
||||
<a href="{% url 'photologue:pl-gallery-archive' %}">⬅ {% trans "View all galleries" %}</a>
|
||||
<h5>{% trans "Filter by year" %}</h5>
|
||||
<div class="list-group">
|
||||
{% for date in date_list %}
|
||||
<a class="list-group-item list-group-item-action{% if date == year %} active{% endif %}" href="{% url 'photologue:pl-gallery-archive-year' date.year %}">{{ date|date:"Y" }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</aside>
|
||||
<main class="col-md-10">
|
||||
{% if object_list %}
|
||||
|
|
@ -26,5 +31,5 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<p>{% trans "No galleries were found." %}</p>
|
||||
{% endif %}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -37,6 +37,12 @@ class GalleryDateView(LoginRequiredMixin):
|
|||
else:
|
||||
return qs.filter(photos__is_public=True).distinct()
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
"""Always show all years in archive"""
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['date_list'] = self.get_queryset().dates(self.date_field, 'year', 'DESC')
|
||||
return context
|
||||
|
||||
|
||||
class GalleryArchiveIndexView(GalleryDateView, ArchiveIndexView):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue