Remove UUID from station and associated settings view and url

parent 8f98361d
Pipeline #42577621 passed with stages
in 5 minutes and 27 seconds
......@@ -156,13 +156,6 @@ class JobSerializer(serializers.ModelSerializer):
return obj.transmitter.baud
class SettingsSerializer(serializers.ModelSerializer):
class Meta:
model = Station
fields = ('uuid', 'name', 'alt', 'lat', 'lng',
'testing', 'antenna', 'id', 'description')
class TransmitterSerializer(serializers.ModelSerializer):
mode = serializers.SerializerMethodField()
norad_cat_id = serializers.SerializerMethodField()
......
......@@ -39,27 +39,6 @@ class JobViewApiTest(TestCase):
self.assertEqual(response_json, [])
@pytest.mark.django_db(transaction=True)
class SettingsViewApiTest(TestCase):
"""
Tests the Job View API
"""
station = None
def setUp(self):
self.station = StationFactory()
self.station.uuid = 'test'
self.station.save()
def test_list(self):
response = self.client.get('/api/settings/')
self.assertEqual(response.status_code, 404)
def test_retrieve(self):
response = self.client.get('/api/settings/%s/' % self.station.uuid)
self.assertContains(response, self.station.name)
@pytest.mark.django_db(transaction=True)
class StationViewApiTest(TestCase):
"""
......
......@@ -7,7 +7,6 @@ router = routers.DefaultRouter()
router.register(r'jobs', views.JobView, base_name='jobs')
router.register(r'data', views.ObservationView, base_name='data')
router.register(r'observations', views.ObservationView, base_name='observations')
router.register(r'settings', views.SettingsView, base_name='settings')
router.register(r'stations', views.StationView, base_name='stations')
router.register(r'transmitters', views.TransmitterView, base_name='transmitters')
......
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.utils.timezone import now
......@@ -61,16 +60,3 @@ class JobView(viewsets.ReadOnlyModelViewSet):
gs.last_seen = now()
gs.save()
return queryset
class SettingsView(viewsets.ReadOnlyModelViewSet):
queryset = Station.objects.all()
lookup_field = 'uuid'
def list(self, request):
raise Http404()
def retrieve(self, request, queryset=queryset, uuid=None):
station = get_object_or_404(queryset, uuid=uuid)
serializer = serializers.SettingsSerializer(station)
return Response(serializer.data)
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2019-01-08 11:12
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0052_auto_20181230_2113'),
]
operations = [
migrations.RemoveField(
model_name='station',
name='uuid',
),
]
......@@ -165,7 +165,6 @@ class Station(models.Model):
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)
uuid = models.CharField(db_index=True, max_length=100, blank=True)
description = models.TextField(max_length=500, blank=True, help_text='Max 500 characters')
client_version = models.CharField(max_length=45, blank=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment