X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/2f331ef41f1d5db23305ec79a02dfbff342ce893..c6537f136f4ec0230f5e7c71dd1abf9616151a47:/src/funding/migrations/0009_move_from_getpaid.py?ds=inline diff --git a/src/funding/migrations/0009_move_from_getpaid.py b/src/funding/migrations/0009_move_from_getpaid.py index 2beeb2484..1bc2a4def 100644 --- a/src/funding/migrations/0009_move_from_getpaid.py +++ b/src/funding/migrations/0009_move_from_getpaid.py @@ -3,42 +3,17 @@ from django.conf import settings from django.db import migrations -def move_from_getpaid(apps, schema_editor): - try: - G = settings.GETPAID_BACKENDS_SETTINGS - except AttributeError: - G = {} - getpaid_conf = False - else: - getpaid_conf = True - - Funding = apps.get_model('funding', 'Funding') - for f in Funding.objects.filter(status=''): - payment = f.payment.first() - # TODO: what happens when no payments any more? - if payment is None: - continue - f.created_at = payment.created_on - f.order_id = payment.external_id - f.pos_id = G.get(payment.backend, {}).get('pos_id', '') - assert getpaid_conf, 'Getpaid configuration removed prematurely.' - f.status = { - 'paid': 'COMPLETED', - 'failed': 'REJECTED', - 'in_progress': 'CANCELLED', - }[payment.status] - f.save() - - class Migration(migrations.Migration): dependencies = [ ('funding', '0008_auto_20221003_1235'), ] + # migration intentionally left empty operations = [ migrations.RunPython( - move_from_getpaid, - migrations.RunPython.noop + migrations.RunPython.noop, + migrations.RunPython.noop, + elidable=True ) ]