Create custom tag for frequencies.
parent
7060aa2641
commit
1567d07a01
|
@ -0,0 +1,44 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('base', '0008_auto_20141027_0113'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='transponder',
|
||||
name='downlink_high',
|
||||
field=models.PositiveIntegerField(null=True, blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='transponder',
|
||||
name='downlink_low',
|
||||
field=models.PositiveIntegerField(null=True, blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='transponder',
|
||||
name='mode',
|
||||
field=models.CharField(max_length=10, choices=[(b'FM', b'FM'), (b'AFSK', b'AFSK'), (b'BFSK', b'BFSK'), (b'APRS', b'APRS'), (b'SSTV', b'SSTV'), (b'CW', b'CW'), (b'FMN', b'FMN')]),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='transponder',
|
||||
name='uplink_high',
|
||||
field=models.PositiveIntegerField(null=True, blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='transponder',
|
||||
name='uplink_low',
|
||||
field=models.PositiveIntegerField(null=True, blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
|
@ -12,7 +12,7 @@ ANTENNA_TYPES = (
|
|||
('helical', 'Helical'),
|
||||
('parabolic', 'Parabolic'),
|
||||
)
|
||||
MODE_CHOICES = ['FM', 'AFSK', 'APRS', 'SSTV', 'CW', 'FMN']
|
||||
MODE_CHOICES = ['FM', 'AFSK', 'BFSK', 'APRS', 'SSTV', 'CW', 'FMN']
|
||||
|
||||
|
||||
class Antenna(models.Model):
|
||||
|
@ -69,10 +69,10 @@ class Transponder(models.Model):
|
|||
"""Model for antennas transponders."""
|
||||
description = models.TextField()
|
||||
alive = models.BooleanField(default=True)
|
||||
uplink_low = models.PositiveIntegerField()
|
||||
uplink_high = models.PositiveIntegerField()
|
||||
downlink_low = models.PositiveIntegerField()
|
||||
downlink_high = models.PositiveIntegerField()
|
||||
uplink_low = models.PositiveIntegerField(blank=True, null=True)
|
||||
uplink_high = models.PositiveIntegerField(blank=True, null=True)
|
||||
downlink_low = models.PositiveIntegerField(blank=True, null=True)
|
||||
downlink_high = models.PositiveIntegerField(blank=True, null=True)
|
||||
mode = models.CharField(choices=zip(MODE_CHOICES, MODE_CHOICES),
|
||||
max_length=10)
|
||||
invert = models.BooleanField(default=False)
|
||||
|
|
|
@ -10,3 +10,11 @@ def active(request, pattern):
|
|||
if re.search(pattern, request.path):
|
||||
return 'active'
|
||||
return None
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def frq(value):
|
||||
to_format = float(value)
|
||||
formatted = format(float(to_format) / 1000000, '.3f')
|
||||
formatted = formatted+' Mhz'
|
||||
return formatted
|
||||
|
|
|
@ -61,10 +61,10 @@ class TransponderFactory(factory.django.DjangoModelFactory):
|
|||
"""Transponder model factory."""
|
||||
description = fuzzy.FuzzyText()
|
||||
alive = fuzzy.FuzzyChoice(choices=[True, False])
|
||||
uplink_low = fuzzy.FuzzyInteger(200, 500)
|
||||
uplink_high = fuzzy.FuzzyInteger(200, 500)
|
||||
downlink_low = fuzzy.FuzzyInteger(200, 500)
|
||||
downlink_high = fuzzy.FuzzyInteger(200, 500)
|
||||
uplink_low = fuzzy.FuzzyInteger(200000000, 500000000, step=10000)
|
||||
uplink_high = fuzzy.FuzzyInteger(200000000, 500000000, step=10000)
|
||||
downlink_low = fuzzy.FuzzyInteger(200000000, 500000000, step=10000)
|
||||
downlink_high = fuzzy.FuzzyInteger(200000000, 500000000, step=10000)
|
||||
mode = fuzzy.FuzzyChoice(choices=MODE_CHOICES)
|
||||
invert = fuzzy.FuzzyChoice(choices=[True, False])
|
||||
baud = fuzzy.FuzzyInteger(4000, 22000, step=1000)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% load staticfiles i18n %}
|
||||
{% load tags %}
|
||||
|
||||
{% block title %}Home{% endblock %}
|
||||
|
||||
|
@ -123,7 +124,7 @@
|
|||
</a>
|
||||
</td>
|
||||
<td>{{ observation.satellite.name }}</td>
|
||||
<td>{{ observation.transponder.downlink_low }}</td>
|
||||
<td>{% frq observation.transponder.downlink_low %}</td>
|
||||
<td>{{ observation.transponder.mode }}</td>
|
||||
<td>{{ observation.start|date:"Y-m-d H:i:s" }}</br>{{ observation.end|date:"Y-m-d H:i:s" }}</td>
|
||||
<td>
|
||||
|
@ -157,7 +158,7 @@
|
|||
</a>
|
||||
</td>
|
||||
<td>{{ observation.satellite.name }}</td>
|
||||
<td>{{ observation.transponder.downlink_low }}</td>
|
||||
<td>{% frq observation.transponder.downlink_low %}</td>
|
||||
<td>{{ observation.transponder.mode }}</td>
|
||||
<td>{{ observation.start|date:"Y-m-d H:i:s" }}</br>{{ observation.end|date:"Y-m-d H:i:s" }}</td>
|
||||
<td>{{ observation.author.get_full_name }}</td>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% load staticfiles %}
|
||||
{% load tags %}
|
||||
|
||||
{% block title %}New Observation{% endblock %}
|
||||
|
||||
|
@ -40,7 +41,7 @@
|
|||
{% for transponder in transponders %}
|
||||
<option data-satellite="{{ transponder.satellite.norad_cat_id }}"
|
||||
value="{{ transponder.id }}">
|
||||
{{ transponder.description }} - {{ transponder.downlink_low }} - {{ transponder.mode }}
|
||||
{{ transponder.description }} - {% frq transponder.downlink_low %} - {{ transponder.mode }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load tags %}
|
||||
|
||||
{% load staticfiles i18n %}
|
||||
|
||||
|
@ -24,7 +25,7 @@
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>{{ observation.satellite.norad_cat_id }} - {{ observation.satellite.name }}</td>
|
||||
<td>{{ observation.transponder.downlink_low }}</td>
|
||||
<td>{% frq observation.transponder.downlink_low %}</td>
|
||||
<td>{{ observation.transponder.mode }}</td>
|
||||
<td>{{ observation.start|date:"Y-m-d H:i:s" }}</br>{{ observation.end|date:"Y-m-d H:i:s" }}</td>
|
||||
<td>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% load tags %}
|
||||
|
||||
{% block title %}Observations{% endblock %}
|
||||
|
||||
|
@ -37,7 +38,7 @@
|
|||
</a>
|
||||
</td>
|
||||
<td>{{ observation.satellite.name }}</td>
|
||||
<td>{{ observation.transponder.downlink_low }}</td>
|
||||
<td>{% frq observation.transponder.downlink_low %}</td>
|
||||
<td>{{ observation.transponder.mode }}</td>
|
||||
<td>{{ observation.start|date:"Y-m-d H:i:s" }}</br>{{ observation.end|date:"Y-m-d H:i:s" }}</td>
|
||||
<td>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
{% load avatar_tags %}
|
||||
{% load static %}
|
||||
{% load tags %}
|
||||
|
||||
{% block title %}User: {{ user.username }}{% endblock %}
|
||||
|
||||
|
@ -105,7 +106,7 @@
|
|||
</a>
|
||||
</td>
|
||||
<td>{{ observation.satellite.name }}</td>
|
||||
<td>{{ observation.transponder.downlink_low }}</td>
|
||||
<td>{% frq observation.transponder.downlink_low %}</td>
|
||||
<td>{{ observation.transponder.mode }}</td>
|
||||
<td>{{ observation.start|date:"Y-m-d H:i:s" }}</br>{{ observation.end|date:"Y-m-d H:i:s" }}</td>
|
||||
<td>{{ observation.author.get_full_name }}</td>
|
||||
|
|
Loading…
Reference in New Issue