Commit d9a38977 authored by Agu Syquia's avatar Agu Syquia

Updated models.py

Edited the model field of "blurb" and implemented inner functions.
parent 96db47f6
...@@ -7,12 +7,17 @@ class Author(models.Model): ...@@ -7,12 +7,17 @@ class Author(models.Model):
nationality = models.CharField(max_length=60) nationality = models.CharField(max_length=60)
bio = models.TextField(max_length=700) bio = models.TextField(max_length=700)
def __str__(self):
name = str(self.first_name + " " + self.last_name)
return name
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)
publisher = models.CharField(max_length=69) publisher = models.CharField(max_length=69)
year_published = models.DateField() year_published = models.DateField()
ISBN = models.IntegerField(default=0) ISBN = models.IntegerField(default=0)
blurb = models.TextField(max_length=200) blurb = models.TextField(max_length=700)
# Create your models here. def __str__(self):
return self
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