36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
# Generated by Django 5.0.7 on 2025-10-25 14:30
|
|
|
|
from django.db import migrations
|
|
|
|
def preload_books(apps, schema_editor):
|
|
Book = apps.get_model('core', 'Book')
|
|
books = [
|
|
('The Great Gatsby', 'F. Scott Fitzgerald', '9780743273565', 5, 5),
|
|
('To Kill a Mockingbird', 'Harper Lee', '9780061120084', 3, 3),
|
|
('1984', 'George Orwell', '9780451524935', 7, 7),
|
|
('The Catcher in the Rye', 'J.D. Salinger', '9780316769488', 4, 4),
|
|
('The Lord of the Rings', 'J.R.R. Tolkien', '9780618640157', 2, 2),
|
|
('Pride and Prejudice', 'Jane Austen', '9780141439518', 6, 6),
|
|
('The Hobbit', 'J.R.R. Tolkien', '9780618260300', 8, 8),
|
|
('Brave New World', 'Aldous Huxley', '9780060850524', 5, 5),
|
|
('Moby Dick', 'Herman Melville', '9781503280786', 3, 3),
|
|
('War and Peace', 'Leo Tolstoy', '9781400079988', 2, 2),
|
|
]
|
|
for title, author, isbn, total_copies, available_copies in books:
|
|
Book.objects.create(
|
|
title=title,
|
|
author=author,
|
|
isbn=isbn,
|
|
total_copies=total_copies,
|
|
available_copies=available_copies
|
|
)
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('core', '0001_initial'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(preload_books),
|
|
] |