@@ -1,4 +1,3 @@ -# Generated by Django 5.0.11 on 2026-01-21 12:18 import math from decimal import Decimal @@ -23,18 +22,21 @@ def update_videos_quantity(apps, schema_editor): payment_features = [] for feature in PaymentPlanFeature.objects.select_related('model', 'plan').filter(model__slug__in=VIDEO_MODELS.keys()): - feature.quantity = math.floor(feature.plan.tokens_per_plan / VIDEO_MODELS[feature.model.slug]) + feature.quantity = math.floor(feature.plan.tokens_per_plan / VIDEO_MODELS[feature.model.slug]) payment_features.append(feature) - PaymentPlanFeature.objects.bulk_update(payment_features, ['quantity']) + if payment_features: + PaymentPlanFeature.objects.bulk_update(payment_features, ['quantity']) class Migration(migrations.Migration): dependencies = [ - ('payments', '0023_reordering_payment_plan_features'), + ('payments', '0024_paymentplan_individual'), ] operations = [ migrations.RunPython(update_videos_quantity, migrations.RunPython.noop) ] + +