8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-30 00:22:25 +00:00
re2o/cotisations/migrations/0038_paiement_is_balance.py
2018-07-05 15:21:51 +02:00

29 lines
867 B
Python

# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-07-04 16:30
from __future__ import unicode_literals
from django.db import migrations, models
def update_balance(apps, _):
Payment = apps.get_model('cotisations', 'Paiement')
try:
balance = Payment.objects.get(moyen="solde")
balance.is_balance = True
balance.save()
except Payment.DoesNotExist:
pass
class Migration(migrations.Migration):
dependencies = [
('cotisations', '0037_auto_20180703_1202'),
]
operations = [
migrations.AddField(
model_name='paiement',
name='is_balance',
field=models.BooleanField(default=False, editable=False, help_text='There should be only one balance payment method.', verbose_name='Is user balance'),
),
migrations.RunPython(update_balance)
]