Change choices of coordination field of TransmitterEntry model
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>spacecruft
parent
ce07c90248
commit
1eb1526cd5
|
@ -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),
|
||||||
|
]
|
|
@ -31,10 +31,10 @@ SERVICE_TYPE = [
|
||||||
'Space Operation', 'Space Research', 'Standard Frequency and Time Signal', 'Unknown'
|
'Space Operation', 'Space Research', 'Standard Frequency and Time Signal', 'Unknown'
|
||||||
]
|
]
|
||||||
COORDINATION_STATUS = [
|
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'
|
'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\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$"
|
URL_REGEX = r"(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$"
|
||||||
MIN_FREQ = 0
|
MIN_FREQ = 0
|
||||||
MAX_FREQ = 40000000000
|
MAX_FREQ = 40000000000
|
||||||
|
|
|
@ -112,7 +112,7 @@ class TransmitterSuggestionFactory(factory.django.DjangoModelFactory):
|
||||||
choices=['Amateur', 'Broadcasting', 'Earth Exploration', 'Fixed', 'Inter-satellite']
|
choices=['Amateur', 'Broadcasting', 'Earth Exploration', 'Fixed', 'Inter-satellite']
|
||||||
)
|
)
|
||||||
coordination = fuzzy.FuzzyChoice(
|
coordination = fuzzy.FuzzyChoice(
|
||||||
choices=['', 'IARU Requested', 'IARU Rejected', 'IARU Coordinated', 'Uncoordinated']
|
choices=['', 'IARU Requested', 'IARU Declined', 'IARU Coordinated', 'Uncoordinated']
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Loading…
Reference in New Issue