From 3aa7f8afe03362997451b0c056d807f4a7aaa96c Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 10 Feb 2021 17:30:26 -0800 Subject: [PATCH] Safer migration runpython function --- bookwyrm/migrations/0044_auto_20210207_1924.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bookwyrm/migrations/0044_auto_20210207_1924.py b/bookwyrm/migrations/0044_auto_20210207_1924.py index 84b17055..7289c73d 100644 --- a/bookwyrm/migrations/0044_auto_20210207_1924.py +++ b/bookwyrm/migrations/0044_auto_20210207_1924.py @@ -10,7 +10,10 @@ def set_user(app_registry, schema_editor): shelfbook = app_registry.get_model('bookwyrm', 'ShelfBook') for item in shelfbook.objects.using(db_alias).filter(user__isnull=True): item.user = item.shelf.user - item.save(broadcast=False) + try: + item.save(broadcast=False) + except TypeError: + item.save() class Migration(migrations.Migration):