Fixes errors in migration

This commit is contained in:
Mouse Reeve 2022-03-16 13:54:25 -07:00
parent 819458e82a
commit 159b73d860

View file

@ -1,7 +1,8 @@
# Generated by Django 3.2.11 on 2022-02-11 13:19
import bookwyrm.models.fields
from django.db import migrations
import bookwyrm.models.fields
from bookwyrm.models import Shelf
def add_shelves(apps, schema_editor):
@ -13,12 +14,14 @@ def add_shelves(apps, schema_editor):
users = apps.get_model("bookwyrm", "User")
local_users = users.objects.using(db_alias).filter(local=True)
for user in local_users:
shelf_model.using(db_alias)(
remote_id = f"{user.remote_id}/books/stopped"
shelf_model.objects.using(db_alias).create(
name="Stopped reading",
identifier=Shelf.STOPPED_READING,
user=user,
editable=False,
).save(broadcast=False)
remote_id=remote_id,
)
class Migration(migrations.Migration):