Add transmitter service field
Fix issue 310 Signed-off-by: Pierros Papadeas <pierros@papadeas.gr>merge-requests/384/head
parent
203f9a7258
commit
48ea435093
|
@ -19,7 +19,7 @@ class TransmitterViewFilter(FilterSet):
|
|||
|
||||
class Meta:
|
||||
model = Transmitter
|
||||
fields = ['uuid', 'mode', 'type', 'satellite__norad_cat_id', 'alive', 'status']
|
||||
fields = ['uuid', 'mode', 'type', 'satellite__norad_cat_id', 'alive', 'status', 'service']
|
||||
|
||||
|
||||
class SatelliteViewFilter(FilterSet):
|
||||
|
|
|
@ -31,7 +31,7 @@ class TransmitterSerializer(serializers.ModelSerializer):
|
|||
fields = (
|
||||
'uuid', 'description', 'alive', 'type', 'uplink_low', 'uplink_high', 'uplink_drift',
|
||||
'downlink_low', 'downlink_high', 'downlink_drift', 'mode_id', 'mode', 'invert', 'baud',
|
||||
'norad_cat_id', 'status', 'updated', 'citation'
|
||||
'norad_cat_id', 'status', 'updated', 'citation', 'service'
|
||||
)
|
||||
|
||||
# Keeping alive field for compatibility issues
|
||||
|
|
|
@ -68,7 +68,7 @@ class SatelliteAdmin(admin.ModelAdmin):
|
|||
@admin.register(TransmitterEntry)
|
||||
class TransmitterEntryAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
'uuid', 'description', 'satellite', 'type', 'mode', 'baud', 'downlink_low',
|
||||
'uuid', 'description', 'satellite', 'service', 'type', 'mode', 'baud', 'downlink_low',
|
||||
'downlink_high', 'downlink_drift', 'uplink_low', 'uplink_high', 'uplink_drift', 'reviewed',
|
||||
'approved', 'status', 'created', 'citation', 'user'
|
||||
)
|
||||
|
@ -78,6 +78,7 @@ class TransmitterEntryAdmin(admin.ModelAdmin):
|
|||
'approved',
|
||||
'type',
|
||||
'status',
|
||||
'service',
|
||||
'mode',
|
||||
'baud',
|
||||
)
|
||||
|
@ -87,7 +88,7 @@ class TransmitterEntryAdmin(admin.ModelAdmin):
|
|||
@admin.register(TransmitterSuggestion)
|
||||
class TransmitterSuggestionAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
'uuid', 'description', 'satellite', 'type', 'mode', 'baud', 'downlink_low',
|
||||
'uuid', 'description', 'satellite', 'service', 'type', 'mode', 'baud', 'downlink_low',
|
||||
'downlink_high', 'downlink_drift', 'uplink_low', 'uplink_high', 'uplink_drift', 'status',
|
||||
'created', 'citation', 'user'
|
||||
)
|
||||
|
@ -96,6 +97,7 @@ class TransmitterSuggestionAdmin(admin.ModelAdmin):
|
|||
'type',
|
||||
'mode',
|
||||
'baud',
|
||||
'service',
|
||||
)
|
||||
readonly_fields = (
|
||||
'uuid', 'description', 'status', 'type', 'uplink_low', 'uplink_high', 'uplink_drift',
|
||||
|
@ -151,7 +153,7 @@ class TransmitterSuggestionAdmin(admin.ModelAdmin):
|
|||
@admin.register(Transmitter)
|
||||
class TransmitterAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
'uuid', 'description', 'satellite', 'type', 'mode', 'baud', 'downlink_low',
|
||||
'uuid', 'description', 'satellite', 'service', 'type', 'mode', 'baud', 'downlink_low',
|
||||
'downlink_high', 'downlink_drift', 'uplink_low', 'uplink_high', 'uplink_drift', 'status',
|
||||
'created', 'citation', 'user'
|
||||
)
|
||||
|
@ -159,6 +161,7 @@ class TransmitterAdmin(admin.ModelAdmin):
|
|||
list_filter = (
|
||||
'type',
|
||||
'status',
|
||||
'service',
|
||||
'mode',
|
||||
'baud',
|
||||
)
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.20 on 2019-07-02 05:59
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('base', '0010_auto_20190421_0143'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='transmitterentry',
|
||||
name='service',
|
||||
field=models.CharField(choices=[('Aeronautical', 'Aeronautical'), ('Amateur', 'Amateur'), ('Broadcasting', 'Broadcasting'), ('Earth Exploration', 'Earth Exploration'), ('Fixed', 'Fixed'), ('Inter-satellite', 'Inter-satellite'), ('Maritime', 'Maritime'), ('Meteorological', 'Meteorological'), ('Mobile', 'Mobile'), ('Radiolocation', 'Radiolocation'), ('Radionavigational', 'Radionavigational'), ('Space Operation', 'Space Operation'), ('Space Research', 'Space Research'), ('Standard Frequency and Time Signal', 'Standard Frequency and Time Signal'), ('Unknown', 'Unknown')], default='Unknown', max_length=34),
|
||||
),
|
||||
]
|
|
@ -25,6 +25,11 @@ DATA_SOURCES = ['manual', 'network', 'sids']
|
|||
SATELLITE_STATUS = ['alive', 'dead', 're-entered']
|
||||
TRANSMITTER_STATUS = ['active', 'inactive', 'invalid']
|
||||
TRANSMITTER_TYPE = ['Transmitter', 'Transceiver', 'Transponder']
|
||||
SERVICE_TYPE = [
|
||||
'Aeronautical', 'Amateur', 'Broadcasting', 'Earth Exploration', 'Fixed', 'Inter-satellite',
|
||||
'Maritime', 'Meteorological', 'Mobile', 'Radiolocation', 'Radionavigational',
|
||||
'Space Operation', 'Space Research', 'Standard Frequency and Time Signal', 'Unknown'
|
||||
]
|
||||
|
||||
|
||||
def _name_payload_frame(instance, filename):
|
||||
|
@ -142,6 +147,9 @@ class TransmitterEntry(models.Model):
|
|||
created = models.DateTimeField(default=now)
|
||||
citation = models.CharField(max_length=512, default='CITATION NEEDED - https://xkcd.com/285/')
|
||||
user = models.ForeignKey(User, null=True, on_delete=models.SET_NULL)
|
||||
service = models.CharField(
|
||||
choices=zip(SERVICE_TYPE, SERVICE_TYPE), max_length=34, default='Unknown'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
unique_together = ("uuid", "created")
|
||||
|
|
|
@ -19,8 +19,9 @@ from django.views.decorators.http import require_POST
|
|||
|
||||
from db.base.forms import TransmitterEntryForm
|
||||
from db.base.helpers import get_apikey
|
||||
from db.base.models import TRANSMITTER_STATUS, TRANSMITTER_TYPE, DemodData, \
|
||||
Mode, Satellite, Transmitter, TransmitterSuggestion
|
||||
from db.base.models import SERVICE_TYPE, TRANSMITTER_STATUS, \
|
||||
TRANSMITTER_TYPE, DemodData, Mode, Satellite, Transmitter, \
|
||||
TransmitterSuggestion
|
||||
from db.base.tasks import export_frames
|
||||
from db.base.utils import cache_statistics
|
||||
|
||||
|
@ -77,6 +78,7 @@ def satellite(request, norad):
|
|||
transmitter_suggestion.transmitter = None
|
||||
modes = Mode.objects.all()
|
||||
types = TRANSMITTER_TYPE
|
||||
services = SERVICE_TYPE
|
||||
statuses = TRANSMITTER_STATUS
|
||||
# TODO: this is a horrible hack, as we have to pass the entire cache to the
|
||||
# template to iterate on, just for one satellite. See #237
|
||||
|
@ -95,6 +97,7 @@ def satellite(request, norad):
|
|||
'transmitter_suggestions': transmitter_suggestions,
|
||||
'modes': modes,
|
||||
'types': types,
|
||||
'services': services,
|
||||
'statuses': statuses,
|
||||
'latest_frame': latest_frame,
|
||||
'sats_cache': sats_cache,
|
||||
|
|
|
@ -112,6 +112,9 @@
|
|||
{% if transmitter.type %}
|
||||
{% include "includes/field.html" with name="Type" value=transmitter.type %}
|
||||
{% endif %}
|
||||
{% if transmitter.service %}
|
||||
{% include "includes/field.html" with name="Service" value=transmitter.service %}
|
||||
{% endif %}
|
||||
{% if transmitter.mode %}
|
||||
{% include "includes/field.html" with name="Mode" value=transmitter.mode %}
|
||||
{% endif %}
|
||||
|
@ -230,6 +233,27 @@
|
|||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group transmitter-element-suggest">
|
||||
<div class="input-group-addon">Service</div>
|
||||
<select class="form-control transmitter_suggestion-service" name="service">
|
||||
{% for service in services %}
|
||||
<option value="{{ service }}" {% ifequal transmitter.service service %}selected{% endifequal %}>
|
||||
{{ service }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group transmitter-element-suggest">
|
||||
<div class="input-group-addon">Mode</div>
|
||||
<select class="form-control" name="mode">
|
||||
<option value="" selected></option>
|
||||
{% for mode in modes %}
|
||||
<option value="{{ mode.id }}" {% ifequal transmitter.mode mode %}selected{% endifequal %}>
|
||||
{{ mode }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group transmitter-element-suggest">
|
||||
<div class="input-group-addon">Uplink Low</div>
|
||||
<input type="number" class="form-control" name="uplink_low" value="{{ transmitter.uplink_low|default_if_none:'' }}">
|
||||
|
@ -258,17 +282,6 @@
|
|||
<div class="input-group-addon">PPB Drift</div>
|
||||
<input type="text" class="form-control downlink-ppb-sugedit" name="downlink_drift" value="{{ transmitter.downlink_drift|default_if_none:'' }}" readonly>
|
||||
</div>
|
||||
<div class="input-group transmitter-element-suggest">
|
||||
<div class="input-group-addon">Mode</div>
|
||||
<select class="form-control" name="mode">
|
||||
<option value="" selected></option>
|
||||
{% for mode in modes %}
|
||||
<option value="{{ mode.id }}" {% ifequal transmitter.mode mode %}selected{% endifequal %}>
|
||||
{{ mode }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group transmitter-element-suggest">
|
||||
<input type="checkbox" value="1" name="invert" {% if transmitter.invert %}checked{% endif %}> Invert
|
||||
</div>
|
||||
|
@ -343,6 +356,9 @@
|
|||
{% if transmitter_suggestion.type %}
|
||||
{% include "includes/field.html" with name="Type" value=transmitter_suggestion.type original=transmitter_suggestion.transmitter.type %}
|
||||
{% endif %}
|
||||
{% if transmitter_suggestion.service %}
|
||||
{% include "includes/field.html" with name="Service" value=transmitter_suggestion.service original=transmitter_suggestion.transmitter.service %}
|
||||
{% endif %}
|
||||
{% if transmitter_suggestion.mode %}
|
||||
{% include "includes/field.html" with name="Mode" value=transmitter_suggestion.mode original=transmitter_suggestion.transmitter.mode %}
|
||||
{% endif %}
|
||||
|
@ -558,6 +574,27 @@
|
|||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group transmitter-element-suggest">
|
||||
<div class="input-group-addon">Service</div>
|
||||
<select class="form-control" name="service" required>
|
||||
{% for service in services %}
|
||||
<option value="{{ service }}">
|
||||
{{ service }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group transmitter-element-suggest">
|
||||
<div class="input-group-addon">Mode</div>
|
||||
<select class="form-control" name="mode">
|
||||
<option value="" selected></option>
|
||||
{% for mode in modes %}
|
||||
<option value="{{ mode.id }}">
|
||||
{{ mode }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group transmitter-element-suggest">
|
||||
<div class="input-group-addon">Uplink_Low</div>
|
||||
<input type="number" class="form-control" name="uplink_low">
|
||||
|
@ -586,17 +623,6 @@
|
|||
<div class="input-group-addon">PPB Drift</div>
|
||||
<input type="text" class="form-control downlink-ppb-sugedit" name="downlink_drift" value="{{ transmitter.downlink_drift|default_if_none:'' }}" readonly>
|
||||
</div>
|
||||
<div class="input-group transmitter-element-suggest">
|
||||
<div class="input-group-addon">Mode</div>
|
||||
<select class="form-control" name="mode">
|
||||
<option value="" selected></option>
|
||||
{% for mode in modes %}
|
||||
<option value="{{ mode.id }}">
|
||||
{{ mode }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group transmitter-element-suggest">
|
||||
<input type="checkbox" value="1" name="invert"> Invert
|
||||
</div>
|
||||
|
|
|
@ -5,5 +5,5 @@ New transmitter suggestion for satellite {{ data.satname }} was submitted by use
|
|||
|
||||
{{ data.saturl }}
|
||||
|
||||
Navigate to {{ data.sitedomain }}/admin/base/suggestion/ to review and approve it.
|
||||
Navigate to {{ data.sitedomain }}/admin/base/transmittersuggestion/ to review and approve it.
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue