Commit 367e8a1c authored by Migs Atienza's avatar Migs Atienza

Added 10 data to models

parent 405d7eb9
from django.contrib import admin from django.contrib import admin
from .models import Author, Book
class AuthorAdmin(admin.ModelAdmin):
model = Author
class BookAdmin(admin.ModelAdmin):
model = Book
# Register your models here. # Register your models here.
admin.site.register(Author, AuthorAdmin)
admin.site.register(Book, BookAdmin)
...@@ -8,6 +8,9 @@ class Author(models.Model): ...@@ -8,6 +8,9 @@ class Author(models.Model):
nationality = models.CharField(max_length=100) nationality = models.CharField(max_length=100)
bio = models.CharField(max_length=700) bio = models.CharField(max_length=700)
def __str__(self):
return '{} {}'.format(self.first_name, self.last_name)
class Book(models.Model): class Book(models.Model):
title = models.CharField(max_length=100) title = models.CharField(max_length=100)
...@@ -15,6 +18,9 @@ class Book(models.Model): ...@@ -15,6 +18,9 @@ class Book(models.Model):
publisher = models.CharField(max_length=100) publisher = models.CharField(max_length=100)
year_published = models.DateField() year_published = models.DateField()
ISBN = models.IntegerField() ISBN = models.IntegerField()
blurb = models.CharField(max_length=200) blurb = models.CharField(max_length=2000)
def __str__(self):
return '{}'.format(self.title)
# Create your models here. # Create your models here.
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