1
0
Fork 0

Change choices of coordination field of TransmitterEntry model

Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>
spacecruft
Alfredos-Panagiotis Damkalis 2022-01-11 06:48:55 +02:00
parent ce07c90248
commit 1eb1526cd5
3 changed files with 32 additions and 3 deletions

View File

@ -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),
]

View File

@ -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

View File

@ -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: