Commit a864f728 authored by Jan Ericsson Ong Ang's avatar Jan Ericsson Ong Ang

created the models for the bookshelf app

parent 86708b87
from django.db import models from django.db import models
# Create your models here. # Create your models here.
class Author(models.Model):
first_name = models.CharField()
last_name = models.CharField()
age = models.IntegerField()
nationality = models.CharField()
bio = models.TextField(max_length=700, default="")
def __str__(self):
return self.first_name + self.last_name
class Books(models.Model):
title = models.CharField()
author = models.ForeignKey(Author, on_delete=models.CASCADE)
publisher = models.CharField()
year_published = models.IntegerField()
ISBN = models.IntegerField()
blurb = models.TextField()
def __str__(self):
return self.title
\ 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