Commit 522b9f3f authored by Jan Ericsson Ong Ang's avatar Jan Ericsson Ong Ang

fix settings.py error & added paramters to models

parent bff36b99
...@@ -2,22 +2,22 @@ from django.db import models ...@@ -2,22 +2,22 @@ from django.db import models
# Create your models here. # Create your models here.
class Author(models.Model): class Author(models.Model):
first_name = models.CharField() first_name = models.CharField(max_length=50, default="")
last_name = models.CharField() last_name = models.CharField(max_length=50, default="")
age = models.IntegerField() age = models.IntegerField(default=0)
nationality = models.CharField() nationality = models.CharField(max_length=50, default="")
bio = models.TextField(max_length=700, default="") bio = models.TextField(max_length=700, default="")
def __str__(self): def __str__(self):
return self.first_name + " " + self.last_name return self.first_name + " " + self.last_name
class Books(models.Model): class Books(models.Model):
title = models.CharField() title = models.CharField(max_length=50, default="")
author = models.ForeignKey(Author, on_delete=models.CASCADE) author = models.ForeignKey(Author, on_delete=models.CASCADE)
publisher = models.CharField() publisher = models.CharField(max_length=50, default="")
year_published = models.IntegerField() year_published = models.IntegerField(default=0)
ISBN = models.IntegerField() ISBN = models.IntegerField(default=0)
blurb = models.TextField() blurb = models.TextField(default="")
def __str__(self): def __str__(self):
return self.title return self.title
\ No newline at end of file
...@@ -31,7 +31,7 @@ ALLOWED_HOSTS = [] ...@@ -31,7 +31,7 @@ ALLOWED_HOSTS = []
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'bookshelf' 'bookshelf',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
......
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