created get absolute url method under Book models

parent 3cc3c9dd
from django.db import models
from django.urls import reverse
#Author
#first_name; last_name; age; nationality; bio
......@@ -26,5 +27,9 @@ class Book(models.Model):
def __str__(self):
return self.title
def get_absolute_url(self):
return(reverse('bookshelf:book-details', 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