Commit e86e9fcf authored by Jan Enzo Salvador's avatar Jan Enzo Salvador

Added a return function to access the author's name and the book's title

parent 1de63ffe
......@@ -7,6 +7,9 @@ class Author(models.Model):
nationality = models.CharField(max_length = 30, default = "")
bio = models.TextField(max_length = 700, default = "")
def __str__(self):
return self.last_name
class Books(models.Model):
title = models.CharField(max_length = 50, default = "")
author = models.ForeignKey(Author, on_delete = models.CASCADE)
......@@ -14,3 +17,6 @@ class Books(models.Model):
year_published = models.IntegerField(default = 0)
ISBN = models.IntegerField(default = 0)
blurb = models.TextField(max_length = 200, default = "")
def __str__(self):
return self.title
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