feat: Add link to report

This commit is contained in:
moanos [he/him] 2024-03-22 12:53:39 +01:00
parent 3516ca1d29
commit 434b069636
5 changed files with 49 additions and 35 deletions

View File

@ -86,6 +86,9 @@ class AdoptionNotice(models.Model):
"""Returns the url to access a detailed page for the animal."""
return reverse('adoption-notice-detail', args=[str(self.id)])
def get_report_url(self):
return reverse('report-adoption-notice', args=[str(self.id)])
def get_photos(self):
"""
First trys to get group photos that are attached to the adoption notice if there is none it trys to fetch

View File

@ -334,6 +334,13 @@ h1 {
border-radius: 10%;
}
.header-card-adoption-notice {
display: flex;
align-items: center;
}
.table-adoption-notice-info {
margin-top: 10px;
}

View File

@ -1,38 +1,7 @@
{% load custom_tags %}
<ul class="adoption-notices">
<div class="adoption-notices">
{% for adoption_notice in adoption_notices %}
<li class="card-adoption-notice">
<div>
<h1><a href="{{ adoption_notice.get_absolute_url }}"> {{ adoption_notice.name }}</a></h1>
<p><b>Notfellchen:</b> {{ adoption_notice.animals.all|join_link:", " | safe }}
</p>
<p>
<b>Ort</b>
{% if adoption_notice.location %}
{{ adoption_notice.location }}
{% else %}
Keine Ort angegeben
{% endif %}
</p>
<p>
{% if adoption_notice.description %}
{{ adoption_notice.description }}
{% else %}
Keine Beschreibung
{% endif %}
</p>
{% if adoption_notice.get_photo %}
<div class="adoption-notice-img">
<img title="{{ adoption_notice.get_photo.title }}"
src="/media/{{ adoption_notice.get_photo.image }}"
alt="{{ adoption_notice.get_photo.alt_text }}">
</div>
{% else %}
No photo
{% endif %}
</div>
</li>
{% include "fellchensammlung/partial-adoption-notice.html" %}
{% endfor %}
</ul>
</div>

View File

@ -0,0 +1,35 @@
{% load custom_tags %}
<div class="card-adoption-notice">
<div>
<div class="header-card-adoption-notice">
<h1><a href="{{ adoption_notice.get_absolute_url }}"> {{ adoption_notice.name }}</a></h1>
<a href="{{ adoption_notice.get_report_url }}">Melden</a>
</div>
<p><b>Notfellchen:</b> {{ adoption_notice.animals.all|join_link:", " | safe }}
</p>
<p>
<b>Ort</b>
{% if adoption_notice.location %}
{{ adoption_notice.location }}
{% else %}
Keine Ort angegeben
{% endif %}
</p>
<p>
{% if adoption_notice.description %}
{{ adoption_notice.description }}
{% else %}
Keine Beschreibung
{% endif %}
</p>
{% if adoption_notice.get_photo %}
<div class="adoption-notice-img">
<img title="{{ adoption_notice.get_photo.title }}"
src="/media/{{ adoption_notice.get_photo.image }}"
alt="{{ adoption_notice.get_photo.alt_text }}">
</div>
{% else %}
No photo
{% endif %}
</div>
</div>

View File

@ -24,7 +24,7 @@ urlpatterns = [
#############
## Reports ##
#############
path("melden/<int:adoption_notice_id>/", views.report_adoption, name="report-adoption-notices"),
path("melden/<int:adoption_notice_id>/", views.report_adoption, name="report-adoption-notice"),
path("meldung/<uuid:report_id>/", views.report_detail, name="report-detail"),
path("meldung/<uuid:report_id>/sucess", views.report_detail_success, name="report-detail-success"),
]