Add ITU coordination field
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>spacecruft
parent
3d4afd6f78
commit
f63ac4294c
|
@ -231,6 +231,7 @@ class TransmitterEntrySerializer(serializers.ModelSerializer):
|
||||||
'service': 'Amateur',
|
'service': 'Amateur',
|
||||||
'iaru_coordination': '',
|
'iaru_coordination': '',
|
||||||
'iaru_coordination_url': '',
|
'iaru_coordination_url': '',
|
||||||
|
'itu_coordination': '',
|
||||||
'coordination': '',
|
'coordination': '',
|
||||||
'coordination_url': ''
|
'coordination_url': ''
|
||||||
},
|
},
|
||||||
|
@ -254,7 +255,8 @@ class TransmitterSerializer(serializers.ModelSerializer):
|
||||||
'uuid', 'description', 'alive', 'type', 'uplink_low', 'uplink_high', 'uplink_drift',
|
'uuid', 'description', 'alive', 'type', 'uplink_low', 'uplink_high', 'uplink_drift',
|
||||||
'downlink_low', 'downlink_high', 'downlink_drift', 'mode', 'mode_id', 'uplink_mode',
|
'downlink_low', 'downlink_high', 'downlink_drift', 'mode', 'mode_id', 'uplink_mode',
|
||||||
'invert', 'baud', 'sat_id', 'norad_cat_id', 'status', 'updated', 'citation', 'service',
|
'invert', 'baud', 'sat_id', 'norad_cat_id', 'status', 'updated', 'citation', 'service',
|
||||||
'iaru_coordination', 'iaru_coordination_url', 'coordination', 'coordination_url'
|
'iaru_coordination', 'iaru_coordination_url', 'itu_coordination', 'coordination',
|
||||||
|
'coordination_url'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Keeping alive field for compatibility issues
|
# Keeping alive field for compatibility issues
|
||||||
|
|
|
@ -27,7 +27,7 @@ class TransmitterCreateForm(BSModalModelForm): # pylint: disable=too-many-ances
|
||||||
'description', 'type', 'status', 'uplink_low', 'uplink_high', 'uplink_drift',
|
'description', 'type', 'status', 'uplink_low', 'uplink_high', 'uplink_drift',
|
||||||
'uplink_mode', 'downlink_low', 'downlink_high', 'downlink_drift', 'downlink_mode',
|
'uplink_mode', 'downlink_low', 'downlink_high', 'downlink_drift', 'downlink_mode',
|
||||||
'invert', 'baud', 'citation', 'service', 'iaru_coordination', 'iaru_coordination_url',
|
'invert', 'baud', 'citation', 'service', 'iaru_coordination', 'iaru_coordination_url',
|
||||||
'coordination', 'coordination_url'
|
'itu_coordination', 'coordination', 'coordination_url'
|
||||||
]
|
]
|
||||||
labels = {
|
labels = {
|
||||||
'downlink_low': _('Downlink freq.'),
|
'downlink_low': _('Downlink freq.'),
|
||||||
|
@ -35,6 +35,7 @@ class TransmitterCreateForm(BSModalModelForm): # pylint: disable=too-many-ances
|
||||||
'invert': _('Inverted Transponder?'),
|
'invert': _('Inverted Transponder?'),
|
||||||
'iaru_coordination': _('IARU Coordination'),
|
'iaru_coordination': _('IARU Coordination'),
|
||||||
'iaru_coordination_url': _('IARU Coordination URL'),
|
'iaru_coordination_url': _('IARU Coordination URL'),
|
||||||
|
'itu_coordination': _('ITU Coordinations URLs'),
|
||||||
}
|
}
|
||||||
widgets = {
|
widgets = {
|
||||||
'description': TextInput(),
|
'description': TextInput(),
|
||||||
|
@ -49,7 +50,7 @@ class TransmitterUpdateForm(BSModalModelForm): # pylint: disable=too-many-ances
|
||||||
'description', 'type', 'status', 'uplink_low', 'uplink_high', 'uplink_drift',
|
'description', 'type', 'status', 'uplink_low', 'uplink_high', 'uplink_drift',
|
||||||
'uplink_mode', 'downlink_low', 'downlink_high', 'downlink_drift', 'downlink_mode',
|
'uplink_mode', 'downlink_low', 'downlink_high', 'downlink_drift', 'downlink_mode',
|
||||||
'invert', 'baud', 'citation', 'service', 'iaru_coordination', 'iaru_coordination_url',
|
'invert', 'baud', 'citation', 'service', 'iaru_coordination', 'iaru_coordination_url',
|
||||||
'coordination', 'coordination_url'
|
'itu_coordination', 'coordination', 'coordination_url'
|
||||||
]
|
]
|
||||||
labels = {
|
labels = {
|
||||||
'downlink_low': _('Downlink freq.'),
|
'downlink_low': _('Downlink freq.'),
|
||||||
|
@ -57,6 +58,7 @@ class TransmitterUpdateForm(BSModalModelForm): # pylint: disable=too-many-ances
|
||||||
'invert': _('Inverted Transponder?'),
|
'invert': _('Inverted Transponder?'),
|
||||||
'iaru_coordination': _('IARU Coordination'),
|
'iaru_coordination': _('IARU Coordination'),
|
||||||
'iaru_coordination_url': _('IARU Coordination URL'),
|
'iaru_coordination_url': _('IARU Coordination URL'),
|
||||||
|
'itu_coordination': _('ITU Coordination URLs'),
|
||||||
}
|
}
|
||||||
widgets = {
|
widgets = {
|
||||||
'description': TextInput(),
|
'description': TextInput(),
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 4.0.4 on 2022-05-22 16:50
|
||||||
|
|
||||||
|
import db.base.models
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('base', '0050_add_iaru_coordination_fields'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='transmitterentry',
|
||||||
|
name='itu_coordination',
|
||||||
|
field=models.JSONField(default=db.base.models.get_default_itu_coordination_field),
|
||||||
|
),
|
||||||
|
]
|
|
@ -106,6 +106,11 @@ def generate_sat_id():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_default_itu_coordination_field():
|
||||||
|
"""Generate default value for itu_coordination field of TransmitterEntry model"""
|
||||||
|
return {'urls': []}
|
||||||
|
|
||||||
|
|
||||||
class SatelliteIdentifier(models.Model):
|
class SatelliteIdentifier(models.Model):
|
||||||
"""Model for Satellite Identifier."""
|
"""Model for Satellite Identifier."""
|
||||||
sat_id = models.CharField(
|
sat_id = models.CharField(
|
||||||
|
@ -501,6 +506,7 @@ class TransmitterEntry(models.Model):
|
||||||
help_text='URL for more details on this frequency coordination',
|
help_text='URL for more details on this frequency coordination',
|
||||||
validators=[URLValidator(schemes=['http', 'https'], regex=URL_REGEX)]
|
validators=[URLValidator(schemes=['http', 'https'], regex=URL_REGEX)]
|
||||||
)
|
)
|
||||||
|
itu_coordination = models.JSONField(default=get_default_itu_coordination_field)
|
||||||
coordination = models.CharField(
|
coordination = models.CharField(
|
||||||
choices=list(zip(COORDINATION_STATUS, COORDINATION_STATUS)),
|
choices=list(zip(COORDINATION_STATUS, COORDINATION_STATUS)),
|
||||||
max_length=20,
|
max_length=20,
|
||||||
|
|
|
@ -417,7 +417,7 @@ CSP_SCRIPT_SRC = config(
|
||||||
'https://*.google-analytics.com,'
|
'https://*.google-analytics.com,'
|
||||||
'https://kit-free.fontawesome.com,'
|
'https://kit-free.fontawesome.com,'
|
||||||
'https://kit.fontawesome.com,'
|
'https://kit.fontawesome.com,'
|
||||||
"'sha256-wMIRCqWVu9YgOwizZzrYvTWAiAn0Y8PQTRdiHy2BNRk='," # transmitter_modal.js
|
"'sha256-hNUUO5rlLTL2RGoi1tx0HAeOoB/Zc30JmlfQDwIq358='," # transmitter_modal.js
|
||||||
)
|
)
|
||||||
CSP_IMG_SRC = config(
|
CSP_IMG_SRC = config(
|
||||||
'CSP_IMG_SRC',
|
'CSP_IMG_SRC',
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
// NOTE: Since this script is loaded dynamically after page load, we have
|
// NOTE: Since this script is loaded dynamically after page load, we have
|
||||||
// to be cautious of CSP requirements. Any changes to this script will need
|
// to be cautious of CSP requirements. Any changes to this script will need
|
||||||
// to have the hash recalculated and changed in settings.py under
|
// to have the hash recalculated and changed in settings.py under
|
||||||
// CSP_SCRIPT_SRC
|
// CSP_SCRIPT_SRC. For hash recalculation use the command:
|
||||||
|
//
|
||||||
|
// cat transmitter_modal.js | openssl sha256 -binary | openssl base64
|
||||||
|
|
||||||
function ppb_to_freq(freq, drift) {
|
function ppb_to_freq(freq, drift) {
|
||||||
var freq_obs = freq + ((freq * drift) / Math.pow(10,9));
|
var freq_obs = freq + ((freq * drift) / Math.pow(10,9));
|
||||||
|
@ -67,6 +69,19 @@ function transmitter_suggestion_type(selection) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
// Initialize ITU Coordination URLs textarea and hide the JSON one
|
||||||
|
$('textarea[name=\'itu_coordination\']').prop('readonly', true);
|
||||||
|
$('#itu-coordination-input-group').hide();
|
||||||
|
var itu_urls = $.parseJSON($('textarea[name=\'itu_coordination\']').val())['urls'];
|
||||||
|
$('textarea[name=\'itu_coordination_per_line\']').val(itu_urls.join('\n'));
|
||||||
|
// Add event for changing JSON textarea when ITU Coordination URLs changes
|
||||||
|
$('textarea[name=\'itu_coordination_per_line\']').on('change click', function(){
|
||||||
|
var itu_coordination_json = $.parseJSON($('textarea[name=\'itu_coordination\']').val());
|
||||||
|
var new_itu_urls = $('textarea[name=\'itu_coordination_per_line\']').val().split('\n');
|
||||||
|
itu_coordination_json['urls'] = new_itu_urls;
|
||||||
|
$('textarea[name=\'itu_coordination\']').val(JSON.stringify(itu_coordination_json));
|
||||||
|
});
|
||||||
|
// Initialize frequency drift fields and their events
|
||||||
$('input[name=\'uplink_drift\']').prop('readonly', true);
|
$('input[name=\'uplink_drift\']').prop('readonly', true);
|
||||||
var uplink_ppb = $('input[name=\'uplink_drift\']').val();
|
var uplink_ppb = $('input[name=\'uplink_drift\']').val();
|
||||||
if (uplink_ppb != 0) {
|
if (uplink_ppb != 0) {
|
||||||
|
@ -89,7 +104,7 @@ $(function () {
|
||||||
var freq = parseInt($('input[name=\'downlink_low\']:visible').val());
|
var freq = parseInt($('input[name=\'downlink_low\']:visible').val());
|
||||||
$('input[name=\'downlink_drift\']').val(freq_to_ppb(freq_obs,freq));
|
$('input[name=\'downlink_drift\']').val(freq_to_ppb(freq_obs,freq));
|
||||||
});
|
});
|
||||||
|
// Initialize fields for transmitter type.
|
||||||
transmitter_suggestion_type($('#id_type option:selected').text());
|
transmitter_suggestion_type($('#id_type option:selected').text());
|
||||||
|
|
||||||
$('#id_type').on('change click', function () {
|
$('#id_type').on('change click', function () {
|
||||||
|
@ -99,4 +114,4 @@ $(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Enable tooltips
|
// Enable tooltips
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
|
|
@ -13,42 +13,53 @@
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="{% if form.non_field_errors %}invalid{% endif %} mb-2">
|
<div class="{% if form.non_field_errors %}invalid{% endif %} mb-2">
|
||||||
{% for error in form.non_field_errors %}
|
{% for error in form.non_field_errors %}
|
||||||
{{ error }}
|
{{ error }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% for field in form %}
|
{% for field in form %}
|
||||||
{% if 'drift' in field.id_for_label %}
|
{% if 'itu_coordination' in field.id_for_label %}
|
||||||
<div class="input-group my-1"
|
<div class="input-group my-1" data-toggle="tooltip" data-placement="bottom"
|
||||||
{% if field.help_text %}
|
title="ITU Coordination URLs each per line">
|
||||||
data-toggle="tooltip" data-placement="bottom" title="Drifted frequency, when different from the published frequency"
|
<label class="input-group-prepend input-group-text" for="{{ field.id_for_label }}_per_line">{{ field.label }}</label>
|
||||||
{% endif %}
|
<textarea name="{{ field.name }}_per_line" placeholder="ITU Coordination URLs each per line" rows="3" wrap="off"
|
||||||
>
|
class="form-control" id="{{ field.id_for_label }}_per_line"></textarea>
|
||||||
<label class="input-group-prepend input-group-text" for="{{ field.id_for_label }}_hz">{{ field.label }} freq.</label>
|
</div>
|
||||||
<input type="number" name="{{ field.name }}_hz" min="-9223372036854775808" max="9223372036854775807"
|
|
||||||
placeholder="Drifted Frequency" class="form-control" id="{{ field.id_for_label }}_hz">
|
|
||||||
<label class="input-group-text input-group-append">Hz</label>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="input-group my-1"
|
|
||||||
{% if field.help_text %}
|
|
||||||
data-toggle="tooltip" data-placement="bottom" title="{{ field.help_text }}"
|
|
||||||
{% endif %}
|
|
||||||
>
|
|
||||||
<label class="input-group-prepend input-group-text" for="{{ field.id_for_label }}">{{ field.label }}</label>
|
|
||||||
{% render_field field class="form-control" placeholder=field.label %}
|
|
||||||
|
|
||||||
{% if 'drift' in field.id_for_label %}
|
|
||||||
<label class="input-group-text input-group-append">PPB</label>
|
|
||||||
{% elif 'low' in field.id_for_label or 'high' in field.id_for_label %}
|
|
||||||
<label class="input-group-text input-group-append">Hz</label>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="{% if field.errors %} invalid{% endif %}">
|
{% if 'drift' in field.id_for_label %}
|
||||||
{% for error in field.errors %}
|
<div class="input-group my-1"
|
||||||
<p class="help-block">{{ error }}</p>
|
{% if field.help_text %}
|
||||||
{% endfor %}
|
data-toggle="tooltip" data-placement="bottom" title="Drifted frequency, when different from the published frequency"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
<label class="input-group-prepend input-group-text" for="{{ field.id_for_label }}_hz">{{ field.label }} freq.</label>
|
||||||
|
<input type="number" name="{{ field.name }}_hz" min="-9223372036854775808" max="9223372036854775807"
|
||||||
|
placeholder="Drifted Frequency" class="form-control" id="{{ field.id_for_label }}_hz">
|
||||||
|
<label class="input-group-text input-group-append">Hz</label>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="input-group my-1"
|
||||||
|
{% if field.help_text %}
|
||||||
|
data-toggle="tooltip" data-placement="bottom" title="{{ field.help_text }}"
|
||||||
|
{% endif %}
|
||||||
|
{% if 'itu_coordination' in field.id_for_label %}
|
||||||
|
id="itu-coordination-input-group"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
<label class="input-group-prepend input-group-text" for="{{ field.id_for_label }}">{{ field.label }}</label>
|
||||||
|
{% render_field field class="form-control" placeholder=field.label %}
|
||||||
|
|
||||||
|
{% if 'drift' in field.id_for_label %}
|
||||||
|
<label class="input-group-text input-group-append">PPB</label>
|
||||||
|
{% elif 'low' in field.id_for_label or 'high' in field.id_for_label %}
|
||||||
|
<label class="input-group-text input-group-append">Hz</label>
|
||||||
|
{% endif %}
|
||||||
|
<div class="{% if field.errors %} invalid{% endif %}">
|
||||||
|
{% for error in field.errors %}
|
||||||
|
<p class="help-block">{{ error }}</p>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -13,42 +13,53 @@
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="{% if form.non_field_errors %}invalid{% endif %} mb-2">
|
<div class="{% if form.non_field_errors %}invalid{% endif %} mb-2">
|
||||||
{% for error in form.non_field_errors %}
|
{% for error in form.non_field_errors %}
|
||||||
{{ error }}
|
{{ error }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% for field in form %}
|
{% for field in form %}
|
||||||
{% if 'drift' in field.id_for_label %}
|
{% if 'itu_coordination' in field.id_for_label %}
|
||||||
<div class="input-group my-1"
|
<div class="input-group my-1" data-toggle="tooltip" data-placement="bottom"
|
||||||
{% if field.help_text %}
|
title="ITU Coordination URLs each per line">
|
||||||
data-toggle="tooltip" data-placement="bottom" title="Drifted frequency, when different from the published frequency"
|
<label class="input-group-prepend input-group-text" for="{{ field.id_for_label }}_per_line">{{ field.label }}</label>
|
||||||
{% endif %}
|
<textarea name="{{ field.name }}_per_line" placeholder="ITU Coordination URLs each per line" rows="3" wrap="off"
|
||||||
>
|
class="form-control" id="{{ field.id_for_label }}_per_line"></textarea>
|
||||||
<label class="input-group-prepend input-group-text" for="{{ field.id_for_label }}_hz">{{ field.label }} freq.</label>
|
</div>
|
||||||
<input type="number" name="{{ field.name }}_hz" min="-9223372036854775808" max="9223372036854775807"
|
|
||||||
placeholder="Drifted Frequency" class="form-control" id="{{ field.id_for_label }}_hz">
|
|
||||||
<label class="input-group-text input-group-append">Hz</label>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="input-group my-1"
|
|
||||||
{% if field.help_text %}
|
|
||||||
data-toggle="tooltip" data-placement="bottom" title="{{ field.help_text }}"
|
|
||||||
{% endif %}
|
|
||||||
>
|
|
||||||
<label class="input-group-prepend input-group-text" for="{{ field.id_for_label }}">{{ field.label }}</label>
|
|
||||||
{% render_field field class="form-control" placeholder=field.label %}
|
|
||||||
|
|
||||||
{% if 'drift' in field.id_for_label %}
|
|
||||||
<label class="input-group-text input-group-append">PPB</label>
|
|
||||||
{% elif 'low' in field.id_for_label or 'high' in field.id_for_label %}
|
|
||||||
<label class="input-group-text input-group-append">Hz</label>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="{% if field.errors %} invalid{% endif %}">
|
{% if 'drift' in field.id_for_label %}
|
||||||
{% for error in field.errors %}
|
<div class="input-group my-1"
|
||||||
<p class="help-block">{{ error }}</p>
|
{% if field.help_text %}
|
||||||
{% endfor %}
|
data-toggle="tooltip" data-placement="bottom" title="Drifted frequency, when different from the published frequency"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
<label class="input-group-prepend input-group-text" for="{{ field.id_for_label }}_hz">{{ field.label }} freq.</label>
|
||||||
|
<input type="number" name="{{ field.name }}_hz" min="-9223372036854775808" max="9223372036854775807"
|
||||||
|
placeholder="Drifted Frequency" class="form-control" id="{{ field.id_for_label }}_hz">
|
||||||
|
<label class="input-group-text input-group-append">Hz</label>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="input-group my-1"
|
||||||
|
{% if field.help_text %}
|
||||||
|
data-toggle="tooltip" data-placement="bottom" title="{{ field.help_text }}"
|
||||||
|
{% endif %}
|
||||||
|
{% if 'itu_coordination' in field.id_for_label %}
|
||||||
|
id="itu-coordination-input-group"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
<label class="input-group-prepend input-group-text" for="{{ field.id_for_label }}">{{ field.label }}</label>
|
||||||
|
{% render_field field class="form-control" placeholder=field.label %}
|
||||||
|
|
||||||
|
{% if 'drift' in field.id_for_label %}
|
||||||
|
<label class="input-group-text input-group-append">PPB</label>
|
||||||
|
{% elif 'low' in field.id_for_label or 'high' in field.id_for_label %}
|
||||||
|
<label class="input-group-text input-group-append">Hz</label>
|
||||||
|
{% endif %}
|
||||||
|
<div class="{% if field.errors %} invalid{% endif %}">
|
||||||
|
{% for error in field.errors %}
|
||||||
|
<p class="help-block">{{ error }}</p>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,14 @@
|
||||||
<dd class="col-sm-6">{{ transmitter.iaru_coordination }}</dd>
|
<dd class="col-sm-6">{{ transmitter.iaru_coordination }}</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if transmitter.itu_coordination.urls %}
|
||||||
|
<dt class="col-sm-6">ITU Coordination</dt>
|
||||||
|
<dd class="col-sm-6"> ITU Coordinated
|
||||||
|
{%for itu_url in transmitter.itu_coordination.urls %}
|
||||||
|
[<a href="{{ itu_url }}" target="_blank">Link {{ forloop.counter }}</a>]
|
||||||
|
{% endfor %}
|
||||||
|
</dd>
|
||||||
|
{% endif %}
|
||||||
{% if transmitter.coordination != '' %}
|
{% if transmitter.coordination != '' %}
|
||||||
<dt class="col-sm-6">Frequency Coordination</dt>
|
<dt class="col-sm-6">Frequency Coordination</dt>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue