Models Created

parent 433850c9
from django.db import models
# Create your models here.
class Author(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
age = models.IntegerField()
nationality = models.CharField(max_length=50)
bio = models.TextField(max_length=700)
def __str__(self):
return '{} {}'.format(self.first_name, self.last_name)
class Books(models.Model):
title = models.CharField()
author = models.ForeignKey(
Author,
on_delete=models.PROTECT
)
publisher = models.CharField()
year_published = models.IntegerField()
ISBN = models.IntegerField(max_length=13)
blurb = models.TextField()
\ No newline at end of file
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