Commit 2f1e2570 authored by karin-kurusu's avatar karin-kurusu

Populated the models "Author" and "Books" with data

parent b2aa3d81
...@@ -6,6 +6,9 @@ class Author(models.Model): ...@@ -6,6 +6,9 @@ class Author(models.Model):
age = models.IntegerField(default="") age = models.IntegerField(default="")
nationality = models.CharField(max_length=250, default="") nationality = models.CharField(max_length=250, default="")
bio = models.CharField(max_length=700, default="") bio = models.CharField(max_length=700, default="")
def __str__(self):
return '{} {}'.format(self.first_name, self.last_name)
class Books(models.Model): class Books(models.Model):
title = models.CharField(max_length=250, default="") title = models.CharField(max_length=250, default="")
...@@ -15,4 +18,7 @@ class Books(models.Model): ...@@ -15,4 +18,7 @@ class Books(models.Model):
ISBN = models.CharField(unique=True, null=True, max_length=13, default="") ISBN = models.CharField(unique=True, null=True, max_length=13, default="")
blurb = models.TextField() blurb = models.TextField()
def __str__(self):
return "\'{}\' by {} {}".format(self.title, self.author.first_name, self.author.last_name)
# Create your models here. # Create your models here.
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