mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-09 11:26:27 +00:00
Merge branch 'fix_migration_0056' into 'dev'
Split migration 0056 See merge request federez/re2o!376
This commit is contained in:
commit
2a42a5e4d2
4 changed files with 68 additions and 28 deletions
|
@ -7,19 +7,6 @@ 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()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
|
@ -94,18 +81,4 @@ class Migration(migrations.Migration):
|
|||
name='vlan_decision_ok',
|
||||
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='vlan_ok_option', to='machines.Vlan'),
|
||||
),
|
||||
|
||||
migrations.RunPython(create_radius_policy),
|
||||
migrations.RemoveField(
|
||||
model_name='optionaltopologie',
|
||||
name='radius_general_policy',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='optionaltopologie',
|
||||
name='vlan_decision_nok',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='optionaltopologie',
|
||||
name='vlan_decision_ok',
|
||||
),
|
||||
]
|
36
preferences/migrations/0056_2_radiusoption.py
Normal file
36
preferences/migrations/0056_2_radiusoption.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
# -*- 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()
|
||||
|
||||
def revert_radius(apps, schema_editor):
|
||||
pass
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('machines', '0095_auto_20180919_2225'),
|
||||
('preferences', '0055_generaloption_main_site_url'),
|
||||
('preferences', '0056_1_radiusoption'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(create_radius_policy, revert_radius),
|
||||
]
|
31
preferences/migrations/0056_3_radiusoption.py
Normal file
31
preferences/migrations/0056_3_radiusoption.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
# -*- 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
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('machines', '0095_auto_20180919_2225'),
|
||||
('preferences', '0055_generaloption_main_site_url'),
|
||||
('preferences', '0056_2_radiusoption'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='optionaltopologie',
|
||||
name='radius_general_policy',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='optionaltopologie',
|
||||
name='vlan_decision_nok',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='optionaltopologie',
|
||||
name='vlan_decision_ok',
|
||||
),
|
||||
]
|
|
@ -8,7 +8,7 @@ from django.db import migrations, models
|
|||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('preferences', '0056_radiusoption'),
|
||||
('preferences', '0056_3_radiusoption'),
|
||||
]
|
||||
|
||||
operations = [
|
Loading…
Reference in a new issue