feat: Link adoption notices in list of them
This commit is contained in:
parent
c27c00c679
commit
29667c86b9
@ -81,6 +81,10 @@ class AdoptionNotice(models.Model):
|
||||
def animals_list(self):
|
||||
return self.animals.all()
|
||||
|
||||
def get_absolute_url(self):
|
||||
"""Returns the url to access a detailed page for the animal."""
|
||||
return reverse('adoption-notice-detail', args=[str(self.id)])
|
||||
|
||||
|
||||
class Animal(models.Model):
|
||||
MALE_NEUTERED = "M_N"
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% for adoption_notice in adoption_notices %}
|
||||
<li>
|
||||
<div>
|
||||
<h1>{{ adoption_notice.name }}</h1>
|
||||
<h1><a href="{{ adoption_notice.get_absolute_url }}"> {{ adoption_notice.name }}</a></h1>
|
||||
<p><b>Notfellchen:</b> {{ adoption_notice.animals.all|join_link:", " | safe }}
|
||||
<ul>
|
||||
{% for animal in adoption_notice.animal_list %}
|
||||
|
Loading…
Reference in New Issue
Block a user