Commit 30c8cf6b authored by Julia Anishka's avatar Julia Anishka

added get_absolute_url function

parent 0eafd77f
......@@ -3,6 +3,8 @@ from datetime import datetime
from django.core.validators import MaxValueValidator, MinValueValidator
from django.core.exceptions import ValidationError
from django.urls import reverse
class Author(models.Model):
first_name = models.CharField(max_length = 50)
last_name = models.CharField(max_length = 50)
......@@ -38,6 +40,9 @@ class Books(models.Model):
def __str__(self):
return self.title
def get_absolute_url(self):
return reverse('bookshelf:books-list', kwargs={'pk': self.pk})
......
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