forked from DGNum/gestioCOF
Simpler migration revert
This commit is contained in:
parent
06a89055c4
commit
946182f1fe
1 changed files with 3 additions and 5 deletions
|
@ -13,11 +13,9 @@ def adapt_operation_types(apps, schema_editor):
|
||||||
|
|
||||||
def revert_operation_types(apps, schema_editor):
|
def revert_operation_types(apps, schema_editor):
|
||||||
Operation = apps.get_model("kfet", "Operation")
|
Operation = apps.get_model("kfet", "Operation")
|
||||||
|
edits = Operation.objects.filter(type='edit')
|
||||||
for ope in Operation.objects.filter(type='edit'):
|
edits.filter(amount__gt=0).update(type='deposit')
|
||||||
ope.type = 'deposit' if ope.amount > 0 else 'withdraw'
|
edits.filter(amount__lte=0).update(type='withdraw')
|
||||||
ope.is_checkout = False
|
|
||||||
ope.save()
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
Loading…
Reference in a new issue