0056_2_radiusoption.py 1018 Bytes
Newer Older
erdnaxe's avatar
erdnaxe committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-10-13 14:29
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import re2o.mixins


def create_radius_policy(apps, schema_editor):
    OptionalTopologie = apps.get_model('preferences', 'OptionalTopologie')
    RadiusOption = apps.get_model('preferences', 'RadiusOption')

    option,_ = OptionalTopologie.objects.get_or_create()

    radius_option = RadiusOption()
    radius_option.radius_general_policy = option.radius_general_policy
    radius_option.vlan_decision_ok = option.vlan_decision_ok

    radius_option.save()

22 23 24
def revert_radius(apps, schema_editor):
    pass

erdnaxe's avatar
erdnaxe committed
25 26 27 28 29 30 31 32 33 34

class Migration(migrations.Migration):

    dependencies = [
        ('machines', '0095_auto_20180919_2225'),
        ('preferences', '0055_generaloption_main_site_url'),
        ('preferences', '0056_1_radiusoption'),
    ]

    operations = [
35
        migrations.RunPython(create_radius_policy, revert_radius),
erdnaxe's avatar
erdnaxe committed
36
    ]