Commit ab5ed2a1 authored by Trisha Angel Millena's avatar Trisha Angel Millena

Created html files: books.html, book_details.html, authors.html,...

Created html files: books.html, book_details.html, authors.html, author_details.html and Updated models.py
parent 3e5c3327
...@@ -12,6 +12,9 @@ class Author(models.Model): ...@@ -12,6 +12,9 @@ class Author(models.Model):
def __str__(self): def __str__(self):
return self.first_name + ' ' + self.last_name return self.first_name + ' ' + self.last_name
def get_absolute_url(self):
return reverse('author-detail', kwargs = {'pk': self.pk},)
class Books(models.Model): class Books(models.Model):
title = models.CharField(max_length = 100) title = models.CharField(max_length = 100)
author = models.ForeignKey(Author, on_delete = models.CASCADE) author = models.ForeignKey(Author, on_delete = models.CASCADE)
...@@ -22,3 +25,6 @@ class Books(models.Model): ...@@ -22,3 +25,6 @@ class Books(models.Model):
def __str__(self): def __str__(self):
return self.title return self.title
def get_absolute_url(self):
return reverse('book-detail', kwargs = {'pk': self.pk},)
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% load static %} {% load static %}
{% block title %} {% endblock %} {% block title %}{% endblock %}
{% block content %} {% block content %}
......
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