feat: Use adoption list template in index too

This commit is contained in:
moanos [he/him] 2024-03-20 10:45:52 +01:00
parent 32021be0f7
commit 1bcdbdbbf5
2 changed files with 7 additions and 9 deletions

View File

@ -3,12 +3,10 @@
{% block content %} {% block content %}
<h1>{% translate "Notfellchen - Vermittlungen finden" %}</h1> <h1>{% translate "Notfellchen - Vermittlungen finden" %}</h1>
<p>{% translate "Alle Tiere brauchen ein liebendes Zuhause. Damit keins vergessen wird gibt es diese Seite. Entwickelt und betreut von " %}<em><a href="https://hyteck.de">moanos</a></em>!</p> <p>{% translate "Alle Tiere brauchen ein liebendes Zuhause. Damit keins vergessen wird gibt es diese Seite. Entwickelt und betreut von " %}<em><a
href="https://hyteck.de">moanos</a></em>!</p>
<h2>{% translate "Aktuelle Vermittlungen" %}</h2> <h2>{% translate "Aktuelle Vermittlungen" %}</h2>
<ul> <ul>
{% for adoption_notice in latest_adoptions %} {% include "fellchensammlung/list-adoption-notices.html" %}
<li><a href="{{ adoption_notice.get_absolute_url }}">{{ adoption_notice.name }}</a>: {{ adoption_notice.animals | join:", " }} </li>
{% endfor %}
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -10,7 +10,7 @@ from .forms import AdoptionNoticeForm, AnimalForm
def index(request): def index(request):
"""View function for home page of site.""" """View function for home page of site."""
latest_adoption_list = AdoptionNotice.objects.order_by("-created_at")[:5] latest_adoption_list = AdoptionNotice.objects.order_by("-created_at")[:5]
context = {"latest_adoptions": latest_adoption_list} context = {"adoption_notices": latest_adoption_list}
return render(request, 'fellchensammlung/index.html', context=context) return render(request, 'fellchensammlung/index.html', context=context)