Fixed model parameters and started with data population

parent db3e54a0
# Generated by Django 4.1.7 on 2023-03-28 12:30
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookshelf', '0002_rename_book_books'),
]
operations = [
migrations.RenameField(
model_name='books',
old_name='course',
new_name='author',
),
]
# Generated by Django 4.1.7 on 2023-03-28 12:33
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bookshelf', '0003_rename_course_books_author'),
]
operations = [
migrations.AlterField(
model_name='books',
name='author',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='bookshelf.author'),
),
]
# Generated by Django 4.1.7 on 2023-03-28 12:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookshelf', '0004_alter_books_author'),
]
operations = [
migrations.AlterField(
model_name='books',
name='year_published',
field=models.IntegerField(blank=True, null=True),
),
]
......@@ -8,11 +8,17 @@ class Author(models.Model):
nationality = models.CharField(max_length=100, blank=True, null=True)
bio = models.TextField(blank=True, null=True)
def __str__(self):
return self.first_name + ' ' + self.last_name
class Books(models.Model):
title = models.CharField(max_length=255, blank=True, null=True)
course = models.ForeignKey(Author, on_delete=models.CASCADE, null=True)
author = models.ForeignKey(Author, on_delete=models.CASCADE, blank=True, null=True)
publisher = models.CharField(max_length=255, blank=True, null=True)
year_published = models.DateField(max_length=255, blank=True, null=True)
year_published = models.IntegerField(blank=True, null=True)
ISBN = models.IntegerField(blank=True, null=True)
blurb = models.TextField(blank=True, null=True)
\ No newline at end of file
blurb = models.TextField(blank=True, null=True)
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