Modified model data types

parent 85b0fc35
......@@ -4,20 +4,20 @@ from django.utils import timezone
class Author(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
age = models.IntegerField(default = 0)
age = models.PositiveIntegerField()
nationality = models.CharField(max_length=100)
bio = models.TextField(max_length=700)
def __str__(self):
return self.first_name, self.last_name
return self.first_name + ' ' + self.last_name
class Book(models.Model):
title = models.CharField(max_length=300)
author = models.ForeignKey(Author, on_delete = models.CASCADE)
publisher = models.CharField(max_length=100)
year_published = models.DateTimeField(default=timezone.now, null=True, blank=True)
ISBN = models.IntegerField(default = 0000000000000)
publisher = models.CharField(max_length=100, default = None)
year_published = models.PositiveIntegerField()
ISBN = models.PositiveIntegerField()
blurb = models.TextField(max_length=200)
def __str__(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