diff --git a/db/base/migrations/0049_rename_choice_of_freq_coordination_field.py b/db/base/migrations/0049_rename_choice_of_freq_coordination_field.py new file mode 100644 index 0000000..03043ac --- /dev/null +++ b/db/base/migrations/0049_rename_choice_of_freq_coordination_field.py @@ -0,0 +1,29 @@ +# Generated by Django 3.2.8 on 2022-01-11 03:59 + +from django.db import migrations, models + + +def change_choice(apps, schema_editor): + TransmitterEntry = apps.get_model('base', 'TransmitterEntry') + TransmitterEntry.objects.filter(coordination='IARU Rejected').update(coordination='IARU Declined') + + +def reverse_choice_change(apps, schema_editor): + TransmitterEntry = apps.get_model('base', 'TransmitterEntry') + TransmitterEntry.objects.filter(coordination='IARU Declined').update(coordination='IARU Rejected') + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0048_add_merge_permission'), + ] + + operations = [ + migrations.AlterField( + model_name='transmitterentry', + name='coordination', + field=models.CharField(blank=True, choices=[('ITU Requested', 'ITU Requested'), ('ITU Rejected', 'ITU Rejected'), ('ITU Coordinated', 'ITU Coordinated'), ('IARU Requested', 'IARU Requested'), ('IARU Declined', 'IARU Declined'), ('IARU Coordinated', 'IARU Coordinated'), ('Uncoordinated', 'Uncoordinated')], default='', help_text='Frequency coordination status for this transmitter', max_length=20), + ), + migrations.RunPython(change_choice, reverse_choice_change), + ] diff --git a/db/base/models.py b/db/base/models.py index 87d0860..91b429e 100644 --- a/db/base/models.py +++ b/db/base/models.py @@ -31,10 +31,10 @@ SERVICE_TYPE = [ 'Space Operation', 'Space Research', 'Standard Frequency and Time Signal', 'Unknown' ] COORDINATION_STATUS = [ - 'ITU Requested', 'ITU Rejected', 'ITU Coordinated', 'IARU Requested', 'IARU Rejected', + 'ITU Requested', 'ITU Rejected', 'ITU Coordinated', 'IARU Requested', 'IARU Declined', 'IARU Coordinated', 'Uncoordinated' ] -BAD_COORDINATIONS = ['ITU Rejected', 'IARU Rejected', 'Uncoordinated'] # 'violations' +BAD_COORDINATIONS = ['ITU Rejected', 'IARU Declined', 'Uncoordinated'] # 'violations' URL_REGEX = r"(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$" MIN_FREQ = 0 MAX_FREQ = 40000000000 diff --git a/db/base/tests.py b/db/base/tests.py index 2fb8979..6b74b09 100644 --- a/db/base/tests.py +++ b/db/base/tests.py @@ -112,7 +112,7 @@ class TransmitterSuggestionFactory(factory.django.DjangoModelFactory): choices=['Amateur', 'Broadcasting', 'Earth Exploration', 'Fixed', 'Inter-satellite'] ) coordination = fuzzy.FuzzyChoice( - choices=['', 'IARU Requested', 'IARU Rejected', 'IARU Coordinated', 'Uncoordinated'] + choices=['', 'IARU Requested', 'IARU Declined', 'IARU Coordinated', 'Uncoordinated'] ) class Meta: