mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 10:01:04 +00:00
Safer migration runpython function
This commit is contained in:
parent
e918ddf526
commit
3aa7f8afe0
1 changed files with 4 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue