Commit d37ac6ea authored by Trisha Angel Millena's avatar Trisha Angel Millena

Created an Author model and a Books model for the bookshelf app

parent 9242fcca
Pipeline #2975 canceled with stages
from django.db import models
# Create your models here.
class Author(models.Model):
first_name = models.CharField(max_length = 100)
last_name = models.CharField(max_length = 100)
age = models.IntegerField()
nationality = models.CharField(max_length = 100)
bio = models.TextField(max_length = 700)
def __strt__(self):
return 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)
def __str__(self):
return self.title
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