From 40ee3b96c32990c7862103257f9230c96c69a675 Mon Sep 17 00:00:00 2001 From: Quentin Durand Date: Thu, 14 Jun 2018 17:15:33 +0200 Subject: [PATCH] adding sunelevation front --- simulators/config/grammar.json | 13 ++++++++++--- src/dashboard/views.py | 7 +++++-- src/misc/templates/base.html | 15 +++++++++------ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/simulators/config/grammar.json b/simulators/config/grammar.json index 82b02c7..c5a739b 100644 --- a/simulators/config/grammar.json +++ b/simulators/config/grammar.json @@ -4,17 +4,24 @@ { "name": "SPEED", "nb_param": [2, 3], - "param_type": "float" + "param_type": "float", + "desc": "description", + "desc": "description", + "help": "help" }, { "name": "COORDS", "nb_param": [2, 3], - "param_type": "float" + "param_type": "float", + "desc": "description", + "help": "help" }, { "name": "TRACKING_SPEED", "nb_param": [2, 3], - "param_type": "float" + "param_type": "float", + "desc": "description", + "help": "help" }, { "name": "ACCEL", diff --git a/src/dashboard/views.py b/src/dashboard/views.py index f15e0e5..c45dd9e 100644 --- a/src/dashboard/views.py +++ b/src/dashboard/views.py @@ -15,6 +15,7 @@ from django.utils.decorators import method_decorator from django.urls import reverse_lazy, reverse from django.http import Http404 import json +from random import randint from devices.Telescope import TelescopeController from devices.TelescopeRemoteControl import TelescopeRemoteControl @@ -39,7 +40,7 @@ def retrieve_env(request): isDay = False if t.hour > 5 and t.hour < 20: isDay = True - return render(request, 'dashboard/observation_status_env.html', ) + return render(request, 'dashboard/observation_status_env.html', locals()) except WeatherWatch.DoesNotExist: raise Http404("No WeatherWatch matches the given query.") @@ -48,7 +49,9 @@ def retrieve_env_navbar(request): try: weather_status = WeatherWatch.objects.latest('updated') weather = serializers.serialize('json', [weather_status]) - return HttpResponse(weather, content_type="application/json") + weather = json.loads(weather) + weather[0]['sunelev'] = randint(-30, 30) + return HttpResponse(json.dumps(weather), content_type="application/json") except WeatherWatch.DoesNotExist: raise Http404("No WeatherWatch matches the given query.") diff --git a/src/misc/templates/base.html b/src/misc/templates/base.html index 551c99a..25c944f 100644 --- a/src/misc/templates/base.html +++ b/src/misc/templates/base.html @@ -112,7 +112,7 @@ a {
  • Images