1
0
Fork 0

New Stations should default to testing

merge-requests/469/head
Nikos Roussos 2018-03-07 17:46:35 +02:00
parent ff9e629b77
commit 0ef63fe2b6
No known key found for this signature in database
GPG Key ID: BADFF1767BA7C8E1
5 changed files with 32 additions and 26 deletions

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-07 15:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0034_auto_20180202_1358'),
]
operations = [
migrations.AlterField(
model_name='station',
name='testing',
field=models.BooleanField(default=True),
),
]

View File

@ -138,7 +138,7 @@ class Station(models.Model):
'target="_blank">SatNOGS Team</a>'))
featured_date = models.DateField(null=True, blank=True)
created = models.DateTimeField(auto_now_add=True)
testing = models.BooleanField(default=False)
testing = models.BooleanField(default=True)
last_seen = models.DateTimeField(null=True, blank=True)
status = models.IntegerField(choices=STATION_STATUSES, default=0)
horizon = models.PositiveIntegerField(help_text='In degrees above 0', default=10)

View File

@ -540,6 +540,13 @@ def station_view(request, id):
can_schedule = schedule_perms(request.user, station)
if station.is_offline:
messages.error(request, ('Your Station is offline. You should make '
'sure it can successfully connect to the Network API.'))
if station.is_testing:
messages.warning(request, ('Your Station is in Testing mode. Once you are '
'sure it returns good observations you can put it online.'))
return render(request, 'base/station_view.html',
{'station': station, 'form': form, 'antennas': antennas,
'mapbox_id': settings.MAPBOX_MAP_ID,
@ -675,9 +682,12 @@ def station_edit(request):
station = get_object_or_404(Station, id=pk, owner=request.user)
form = StationForm(request.POST, request.FILES, instance=station)
else:
pk = False
form = StationForm(request.POST, request.FILES)
if form.is_valid():
f = form.save(commit=False)
if not pk:
f.testing = True
f.owner = request.user
f.save()
form.save_m2m()

View File

@ -8,30 +8,6 @@ a:hover {
text-decoration: none;
}
.alert-debug {
color: black;
background-color: white;
border-color: #d6e9c6;
}
.alert-info {
color: #3a87ad;
background-color: #d9edf7;
border-color: #bce8f1;
}
.alert-success {
color: #468847;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.alert-warning {
color: black;
background-color: orange;
border-color: #d6e9c6;
}
.alert-error {
color: #b94a48;
background-color: #f2dede;

View File

@ -101,7 +101,7 @@
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<input type="checkbox" name="testing" {% if form.testing.value %}checked="True"{% endif %}>
<input type="checkbox" name="testing" {% if form.testing.value %}checked="True"{% endif %} {% if not station.id %}disabled{% endif %}>
Testing?
</div>
</div>