feat: Add adoption notice detail view
This commit is contained in:
parent
96c82ef8e5
commit
f47fc5eee2
@ -78,8 +78,8 @@ class AdoptionNotice(models.Model):
|
|||||||
photos = models.ManyToManyField(Image, blank=True)
|
photos = models.ManyToManyField(Image, blank=True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def animals_list(self):
|
def animals(self):
|
||||||
return self.animals.all()
|
return Animal.objects.filter(adoption_notice=self)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
"""Returns the url to access a detailed page for the animal."""
|
"""Returns the url to access a detailed page for the animal."""
|
||||||
|
@ -16,7 +16,9 @@ def index(request):
|
|||||||
|
|
||||||
|
|
||||||
def adoption_notice_detail(request, adoption_notice_id):
|
def adoption_notice_detail(request, adoption_notice_id):
|
||||||
return HttpResponse("You're looking at adoption notice %s." % adoption_notice_id)
|
adoption_notice = AdoptionNotice.objects.get(id=adoption_notice_id)
|
||||||
|
context = {"adoption_notice": adoption_notice}
|
||||||
|
return render(request, 'fellchensammlung/detail_adoption_notice.html', context=context)
|
||||||
|
|
||||||
|
|
||||||
def animal_detail(request, animal_id):
|
def animal_detail(request, animal_id):
|
||||||
|
Loading…
Reference in New Issue
Block a user