Commit 428e58bf authored by Ysobel Vera's avatar Ysobel Vera

Populated the models

Populated the Author and Books models with 15 records each.
parent 64be1536
......@@ -7,12 +7,17 @@ class Author(models.Model):
nationality = models.CharField(max_length=100)
bio = models. TextField(max_length=700)
def __str__(self):
return '{} {}'.format(self.first_name, self.last_name)
class Books(models.Model):
title = models.CharField(max_length=100)
author = models.ForeignKey(Author, on_delete=models.CASCADE)
publisher = models.CharField(max_length=100)
year_published = models.IntegerField()
ISBN = models.IntegerField()
blurb = models.TextField(max_length=200)
blurb = models.TextField(max_length=1200)
def __str__(self):
return '{} ({}) by {}'.format(self.title, self.year_published, self.author)
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