From 434b0696362db43d0f5beaa80c02fa753efe0c18 Mon Sep 17 00:00:00 2001 From: moanos Date: Fri, 22 Mar 2024 12:53:39 +0100 Subject: [PATCH] feat: Add link to report --- src/fellchensammlung/models.py | 3 ++ .../static/fellchensammlung/css/styles.css | 7 ++++ .../list-adoption-notices.html | 37 ++----------------- .../partial-adoption-notice.html | 35 ++++++++++++++++++ src/fellchensammlung/urls.py | 2 +- 5 files changed, 49 insertions(+), 35 deletions(-) create mode 100644 src/fellchensammlung/templates/fellchensammlung/partial-adoption-notice.html diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py index 92a1470..116a4b5 100644 --- a/src/fellchensammlung/models.py +++ b/src/fellchensammlung/models.py @@ -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 diff --git a/src/fellchensammlung/static/fellchensammlung/css/styles.css b/src/fellchensammlung/static/fellchensammlung/css/styles.css index 480e71a..4c2d5d3 100644 --- a/src/fellchensammlung/static/fellchensammlung/css/styles.css +++ b/src/fellchensammlung/static/fellchensammlung/css/styles.css @@ -334,6 +334,13 @@ h1 { border-radius: 10%; } + +.header-card-adoption-notice { + display: flex; + align-items: center; + +} + .table-adoption-notice-info { margin-top: 10px; } diff --git a/src/fellchensammlung/templates/fellchensammlung/list-adoption-notices.html b/src/fellchensammlung/templates/fellchensammlung/list-adoption-notices.html index 5e97af0..20b9bb3 100644 --- a/src/fellchensammlung/templates/fellchensammlung/list-adoption-notices.html +++ b/src/fellchensammlung/templates/fellchensammlung/list-adoption-notices.html @@ -1,38 +1,7 @@ -{% load custom_tags %} - + diff --git a/src/fellchensammlung/templates/fellchensammlung/partial-adoption-notice.html b/src/fellchensammlung/templates/fellchensammlung/partial-adoption-notice.html new file mode 100644 index 0000000..3106a33 --- /dev/null +++ b/src/fellchensammlung/templates/fellchensammlung/partial-adoption-notice.html @@ -0,0 +1,35 @@ +{% load custom_tags %} +
+
+ +

Notfellchen: {{ adoption_notice.animals.all|join_link:", " | safe }} +

+

+ Ort + {% if adoption_notice.location %} + {{ adoption_notice.location }} + {% else %} + Keine Ort angegeben + {% endif %} +

+

+ {% if adoption_notice.description %} + {{ adoption_notice.description }} + {% else %} + Keine Beschreibung + {% endif %} +

+ {% if adoption_notice.get_photo %} +
+ {{ adoption_notice.get_photo.alt_text }} +
+ {% else %} + No photo + {% endif %} +
+
\ No newline at end of file diff --git a/src/fellchensammlung/urls.py b/src/fellchensammlung/urls.py index 94937be..eea99b4 100644 --- a/src/fellchensammlung/urls.py +++ b/src/fellchensammlung/urls.py @@ -24,7 +24,7 @@ urlpatterns = [ ############# ## Reports ## ############# - path("melden//", views.report_adoption, name="report-adoption-notices"), + path("melden//", views.report_adoption, name="report-adoption-notice"), path("meldung//", views.report_detail, name="report-detail"), path("meldung//sucess", views.report_detail_success, name="report-detail-success"), ]