python formatting

This commit is contained in:
Mouse Reeve 2021-04-08 15:11:16 -07:00
parent b1491c2ac6
commit ee6f37d7d2
3 changed files with 32 additions and 4 deletions

View file

@ -55,6 +55,7 @@ class OrderedCollectionPage(ActivityObject):
@dataclass(init=False)
class CollectionItem(ActivityObject):
""" an item in a collection """
actor: str
type: str = "CollectionItem"
@ -62,6 +63,7 @@ class CollectionItem(ActivityObject):
@dataclass(init=False)
class ListItem(CollectionItem):
""" a book on a list """
book: str
notes: str = None
approved: bool = True
@ -72,5 +74,6 @@ class ListItem(CollectionItem):
@dataclass(init=False)
class ShelfItem(CollectionItem):
""" a book on a list """
book: str
type: str = "ShelfItem"

View file

@ -0,0 +1,28 @@
# Generated by Django 3.1.6 on 2021-04-08 22:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0063_auto_20210408_1556"),
]
operations = [
migrations.AlterField(
model_name="listitem",
name="book_list",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="bookwyrm.list"
),
),
migrations.AlterField(
model_name="shelfbook",
name="shelf",
field=models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT, to="bookwyrm.shelf"
),
),
]

View file

@ -65,10 +65,7 @@ class List(TestCase):
)
item = models.ListItem.objects.create(
book_list=book_list,
book=self.book,
user=self.local_user,
approved=False
book_list=book_list, book=self.book, user=self.local_user, approved=False
)
self.assertFalse(item.approved)