8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-20 10:23:12 +00:00
re2o/cotisations/migrations/0037_auto_20180703_1202.py
2018-07-12 14:42:13 +02:00

35 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-07-03 17:02
from __future__ import unicode_literals
from django.db import migrations, models
def create_max_balance(apps, schema_editor):
OptionalUser = apps.get_model('preferences', 'OptionalUser')
Payment = apps.get_model('cotisations', 'Paiement')
balance, _created = Payment.objects.get_or_create(moyen='solde')
options, _created = OptionalUser.objects.get_or_create()
balance.maximum_balance = options.max_solde
balance.save()
class Migration(migrations.Migration):
dependencies = [
('cotisations', '0036_auto_20180703_1056'),
]
operations = [
migrations.AlterModelOptions(
name='paiement',
options={'permissions': (('view_paiement', "Can see a payement's details"), ('use_every_payment', 'Can use every payement')), 'verbose_name': 'Payment method', 'verbose_name_plural': 'Payment methods'},
),
migrations.AddField(
model_name='balancepayment',
name='maximum_balance',
field=models.DecimalField(decimal_places=2, default=50, help_text='The maximal amount of money allowed for the balance.', max_digits=5, verbose_name='Maximum balance'),
),
migrations.RunPython(create_max_balance)
]