Commit b7800f75 authored by Nate Brevin A. Que's avatar Nate Brevin A. Que

Updated models.py to import the 'reverse' function and update the...

Updated models.py to import the 'reverse' function and update the 'get_absolute_url' functions appropriately.
parent d3402d69
from django.db import models
from django.urls import reverse
class Author(models.Model):
......@@ -12,7 +13,7 @@ class Author(models.Model):
return '{} {}'.format(self.first_name, self.last_name)
def get_absolute_url(self):
return reverse('author_detail', args=[str(self)])
return reverse('bookshelf:author-details', kwargs={'pk':self.pk})
class Books(models.Model):
......@@ -27,4 +28,4 @@ class Books(models.Model):
return '{} by {}'.format(self.title, self.author)
def get_absolute_url(self):
return reverse('books_detail', args=[str(self)])
\ No newline at end of file
return reverse('bookshelf:book-details', kwargs={'pk':self.pk})
\ No newline at end of file
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