Files
edx-platform/common/djangoapps/entitlements/migrations/0010_backfill_refund_lock.py
Feanil Patel 9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00

32 lines
1.0 KiB
Python

# -*- coding: utf-8 -*-
from datetime import datetime
from django.db import migrations, models
def backfill_refundability(apps, schema_editor):
CourseEntitlementSupportDetail = apps.get_model('entitlements', 'CourseEntitlementSupportDetail')
for support_detail in CourseEntitlementSupportDetail.objects.all().select_related('entitlement'):
support_detail.entitlement.refund_locked = True
support_detail.entitlement.save()
def revert_backfill(apps, schema_editor):
CourseEntitlementSupportDetail = apps.get_model('entitlements', 'CourseEntitlementSupportDetail')
for support_detail in CourseEntitlementSupportDetail.objects.all().select_related('entitlement'):
support_detail.entitlement.refund_locked = False
support_detail.entitlement.save()
class Migration(migrations.Migration):
dependencies = [
('entitlements', '0009_courseentitlement_refund_locked'),
]
operations = [
migrations.RunPython(backfill_refundability, revert_backfill),
]