Skip to content

Commit 72c08ae

Browse files
committed
fix migration
1 parent 3766108 commit 72c08ae

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

backend/proteins/migrations/0056_auto_20240920_1426.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
# Generated by Django 4.2.1 on 2024-09-20 14:26
2-
2+
import logging
33
from contextlib import suppress
44
from django.db import migrations
55
from proteins.models import Spectrum
66

7+
logger = logging.getLogger(__name__)
8+
9+
710
def set_default_status(apps, schema_editor):
8-
for spectrum in Spectrum.objects.all():
11+
for spectrum in Spectrum.objects.all_objects():
912
try:
1013
spectrum.status = Spectrum.STATUS.approved
1114
spectrum.save()
12-
except Exception:
13-
print(f"Failed to resave spectrum id: {spectrum.id}")
15+
except Exception as e:
16+
logger.error(f"Failed to resave spectrum id: {spectrum.id}", exc_info=e)
1417

1518
class Migration(migrations.Migration):
1619

0 commit comments

Comments
 (0)