Commit 46e912e3 authored by Ysabella Panghulan's avatar Ysabella Panghulan

added get_absolute_url method in Books class

parent 6dd0cb7d
from datetime import datetime
from django.db import models
from django.urls import reverse
from django.core.exceptions import ValidationError
# Create your models here.
......@@ -39,6 +40,8 @@ class Books(models.Model):
ISBN = models.CharField(max_length=13, validators=[validate_ISBN])
blurb = models.TextField(validators=[validate_wordCount])
def __str__(self):
return self.title
def get_absolute_url(self):
return reverse('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