Commit 5d7303e0 authored by rachbit's avatar rachbit

fixed missing functions in bookshelf/models

parent 5e90bd32
......@@ -12,6 +12,10 @@ class Author(models.Model):
def __str__(self):
return '{} {}'.format(self.first_name, self.last_name)
def get_absolute_url(self):
return reverse("bookshelf:author_details",kwargs={'pk':self.pk})
class Book(models.Model):
title = models.CharField(max_length=100)
......@@ -23,3 +27,6 @@ class Book(models.Model):
def __str__(self):
return '{}'.format(self.title)
def get_absolute_url(self):
return reverse("bookshelf:book_details",kwargs={'pk':self.pk})
......@@ -9,7 +9,7 @@
{% for object in object_list %}
<li>
<a href="{{ object.get_absolute_url }}">
{{ object.first_name }}{{ object.last_name }}
{{object.first_name}} {{object.last_name}}
</a>
</li>
{% endfor %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment