From 72c08aeb964bc43e26231d51ae79dc58c81cf708 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Tue, 24 Sep 2024 09:48:39 -0400 Subject: [PATCH] fix migration --- .../proteins/migrations/0056_auto_20240920_1426.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/proteins/migrations/0056_auto_20240920_1426.py b/backend/proteins/migrations/0056_auto_20240920_1426.py index 785fa913..578ee25e 100644 --- a/backend/proteins/migrations/0056_auto_20240920_1426.py +++ b/backend/proteins/migrations/0056_auto_20240920_1426.py @@ -1,16 +1,19 @@ # Generated by Django 4.2.1 on 2024-09-20 14:26 - +import logging from contextlib import suppress from django.db import migrations from proteins.models import Spectrum +logger = logging.getLogger(__name__) + + def set_default_status(apps, schema_editor): - for spectrum in Spectrum.objects.all(): + for spectrum in Spectrum.objects.all_objects(): try: spectrum.status = Spectrum.STATUS.approved spectrum.save() - except Exception: - print(f"Failed to resave spectrum id: {spectrum.id}") + except Exception as e: + logger.error(f"Failed to resave spectrum id: {spectrum.id}", exc_info=e) class Migration(migrations.Migration):