# -*- 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) ]