mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 16:40:36 +00:00
Fixes errors in migration
This commit is contained in:
parent
819458e82a
commit
159b73d860
1 changed files with 6 additions and 3 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue