-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc3c5a1
commit 04653a4
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 5.0.6 on 2024-06-05 11:17 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('books', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='book', | ||
name='author', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='books', to='books.author'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
from app.models import TimestampedModel | ||
from django.db import models | ||
from django.db.models.manager import Manager | ||
|
||
|
||
class Author(TimestampedModel): | ||
name = models.CharField(max_length=255) | ||
books: "Manager[Book]" | ||
|
||
|
||
class Book(TimestampedModel): | ||
author = models.ForeignKey(Author, on_delete=models.CASCADE) | ||
author = models.ForeignKey(Author, on_delete=models.CASCADE, related_name="books") | ||
name = models.CharField(max_length=255) |