Commit 5f148e7db622e3b3b8645cf8020af986526d566e

Authored by Unknown
1 parent 2591cc34
Exists in dev

Update to django2 and updating dependencies

install/REQUIREMENTS.txt
... ... @@ -2,29 +2,29 @@ amqp==1.4.9
2 2 amqplib==1.0.2
3 3 anyjson==0.3.3
4 4 billiard==3.3.0.23
5   -requests==2.12.3
  5 +requests==2.18.4
6 6 celery==3.1.25
7   -DateTime==4.1.1
  7 +DateTime==4.2
8 8 Django==2.0.5
9   -django-admin-tools==0.7.2
10   -django-bootstrap3==7.0.1
11   -django-celery==3.1.17
12   -django-debug-toolbar==1.4
13   -django-extensions==1.6.1
14   -django-suit==0.2.18
15   -django-test-without-migrations==0.4
16   -gunicorn==19.4.5
17   -iso8601==0.1.11
18   -jdcal==1.2
19   -kombu==3.0.35
20   -lxml==3.6.0
  9 +django-admin-tools==0.8.1
  10 +django-bootstrap3==10.0.1
  11 +django-celery==3.2.2
  12 +django-debug-toolbar==1.9.1
  13 +django-extensions==2.0.7
  14 +django-suit==0.2.26
  15 +django-test-without-migrations==0.6
  16 +gunicorn==19.8.1
  17 +iso8601==0.1.12
  18 +jdcal==1.4
  19 +kombu==3.0.37
  20 +lxml==3.8.0
21 21 mysqlclient==1.3.12
22   -pluggy==0.3.1
23   -py==1.4.31
24   -pytz==2016.4
25   -six==1.10.0
26   -sqlparse==0.1.19
27   -Twisted==16.0.0
28   -voevent-parse==0.9.5
29   -zope.interface==4.1.1
30   -flower
  22 +pluggy==0.6.0
  23 +py==1.5.3
  24 +pytz==2018.4
  25 +six==1.11.0
  26 +sqlparse==0.2.4
  27 +Twisted==18.4.0
  28 +voevent-parse==1.0.2
  29 +zope.interface==4.5.0
  30 +flower==0.9.2
... ...
src/common/models.py
... ... @@ -392,7 +392,7 @@ class Request(models.Model):
392 392  
393 393  
394 394 class Alert(Request):
395   - request = models.OneToOneField('Request', on_delete=models.CASCADE, default='')
  395 + request = models.OneToOneField('Request', on_delete=models.CASCADE, default='', parent_link=True)
396 396 strategyobs = models.ForeignKey(
397 397 'StrategyObs', models.DO_NOTHING, related_name="alerts", blank=True, null=True)
398 398 voevent_file = models.CharField(max_length=45, blank=True, null=True)
... ...
src/dashboard/views.py
1 1 from django.http import HttpResponse
2 2 from django.shortcuts import render, redirect
3   -from django.core import urlresolvers
  3 +
4 4 from django.contrib.auth.decorators import login_required
5 5 import datetime
6 6 from common.models import Log, WeatherWatch, SiteWatch, ScientificProgram, Config
... ... @@ -10,7 +10,8 @@ from dashboard.forms import ConfigForm
10 10 from django.views.generic.edit import UpdateView
11 11 from django.shortcuts import get_object_or_404
12 12 from django.utils.decorators import method_decorator
13   -from django.urls import reverse_lazy
  13 +from django.urls import reverse_lazy, reverse
  14 +from django.http import Http404
14 15  
15 16 log = l.setupLogger("dashboard", "dashboard")
16 17  
... ... @@ -26,28 +27,35 @@ def index(request):
26 27  
27 28 @login_required
28 29 def retrieve_env(request):
29   - weather_status = WeatherWatch.objects.latest('updated')
30   - t = datetime.datetime.now() + datetime.timedelta(hours=-7) #temporary method to demonstrate the day/night display
31   - isDay = False
32   - if t.hour > 5 and t.hour < 20:
33   - isDay = True
34   - return render(request, 'dashboard/observation_status_env.html', locals())
  30 + try:
  31 + weather_status = WeatherWatch.objects.latest('updated')
  32 + t = datetime.datetime.now() + datetime.timedelta(hours=-7) #temporary method to demonstrate the day/night display
  33 + isDay = False
  34 + if t.hour > 5 and t.hour < 20:
  35 + isDay = True
  36 + return render(request, 'dashboard/observation_status_env.html', locals())
  37 + except WeatherWatch.DoesNotExist:
  38 + raise Http404("No WeatherWatch matches the given query.")
  39 +
35 40  
36 41 @login_required
37 42 def retrieve_env_navbar(request):
38 43 if request.is_ajax():
39   - weather_status = WeatherWatch.objects.latest('updated')
40   - weather = serializers.serialize('json', [weather_status])
41   - return HttpResponse(weather, content_type="application/json")
  44 + try:
  45 + weather_status = WeatherWatch.objects.latest('updated')
  46 + weather = serializers.serialize('json', [weather_status])
  47 + return HttpResponse(weather, content_type="application/json")
  48 + except WeatherWatch.DoesNotExist:
  49 + raise Http404("No WeatherWatch matches the given query.")
42 50  
43 51 @login_required
44 52 def users(request):
45   - url_ = urlresolvers.reverse('admin:auth_user_changelist')
  53 + url_ = reverse('admin:auth_user_changelist')
46 54 return redirect(url_)
47 55  
48 56 @login_required
49 57 def routines(request):
50   - url_ = urlresolvers.reverse('admin:common_request_changelist')
  58 + url_ = reverse('admin:common_request_changelist')
51 59 return redirect(url_)
52 60  
53 61  
... ... @@ -108,7 +116,7 @@ def configUpdate(request):
108 116  
109 117 @login_required
110 118 def devices(request):
111   - url_ = urlresolvers.reverse('admin:common_device_changelist')
  119 + url_ = reverse('admin:common_device_changelist')
112 120 return redirect(url_)
113 121  
114 122 @login_required
... ... @@ -132,13 +140,13 @@ def system_retrieve_logs(request):
132 140  
133 141 @login_required
134 142 def schedule(request):
135   - url_ = urlresolvers.reverse('admin:common_schedule_changelist')
  143 + url_ = reverse('admin:common_schedule_changelist')
136 144 return redirect(url_)
137 145  
138 146  
139 147 @login_required
140 148 def quotas(request):
141   - url_ = urlresolvers.reverse('admin:common_pyrosuser_changelist')
  149 + url_ = reverse('admin:common_pyrosuser_changelist')
142 150 return redirect(url_)
143 151  
144 152  
... ...
src/devices/views.py
1 1 from django.shortcuts import render
2 2 from common.models import Log
3 3 from django.http import HttpResponse
4   -from django.core import urlresolvers
5 4 from django.core import serializers
6 5 from django.contrib.auth.decorators import login_required
  6 +import django.urls
7 7  
8 8 MAX_LOGS_LINES = 200
9 9 # Create your views here.
... ...
src/pyros/settings.py
... ... @@ -53,7 +53,7 @@ SECRET_KEY = &#39;0*@w)$rq4x1c2w!c#gn58*$*u$w=s8uw2zpr_c3nj*u%qlxc23&#39;
53 53 # SECURITY WARNING: don't run with debug turned on in production!
54 54 DEBUG = True
55 55  
56   -ALLOWED_HOSTS = ['localhost']
  56 +ALLOWED_HOSTS = ['localhost', '127.0.0.1']
57 57  
58 58  
59 59 # Application definition
... ... @@ -85,13 +85,12 @@ INSTALLED_APPS = [
85 85 #'kombu.transport.django'
86 86 ]
87 87  
88   -MIDDLEWARE_CLASSES = [
  88 +MIDDLEWARE = [
89 89 'django.middleware.security.SecurityMiddleware',
90 90 'django.contrib.sessions.middleware.SessionMiddleware',
91 91 'django.middleware.common.CommonMiddleware',
92 92 'django.middleware.csrf.CsrfViewMiddleware',
93 93 'django.contrib.auth.middleware.AuthenticationMiddleware',
94   - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
95 94 'django.contrib.messages.middleware.MessageMiddleware',
96 95 'django.middleware.clickjacking.XFrameOptionsMiddleware',
97 96 ]
... ...
src/user_manager/views.py
... ... @@ -9,7 +9,7 @@ def home(request):
9 9 '''
10 10 Initial login view when coming on the website
11 11 '''
12   - if request.user.is_authenticated():
  12 + if request.user.is_authenticated:
13 13 return(render(request, LOGGED_PAGE, {'message' : "You are already connected", 'success' : True}))
14 14 return(render(request, "user_manager/home_login.html"))
15 15  
... ... @@ -17,7 +17,7 @@ def create_user(request):
17 17 '''
18 18 View called to open the user creation form
19 19 '''
20   - if request.user.is_authenticated():
  20 + if request.user.is_authenticated:
21 21 return(render(request, LOGGED_PAGE, {'message' : "You are already connected", 'success' : True}))
22 22 form = PyrosUserCreationForm()
23 23 return (render(request, "user_manager/home_user_creation.html", locals()))
... ... @@ -26,7 +26,7 @@ def user_signup_validation(request):
26 26 '''
27 27 View called to validate the user creation (form submitted)
28 28 '''
29   - if request.user.is_authenticated():
  29 + if request.user.is_authenticated:
30 30 return(render(request, LOGGED_PAGE, {'message' : "You are already connected", 'success' : True}))
31 31 form = PyrosUserCreationForm(request.POST)
32 32 if request.POST:
... ... @@ -48,7 +48,7 @@ def login_validation(request):
48 48 '''
49 49 View called when the user log in (form submitted)
50 50 '''
51   - if request.user.is_authenticated():
  51 + if request.user.is_authenticated:
52 52 return(render(request, LOGGED_PAGE, {'message' : "You are already connected", 'success' : True}))
53 53 username = password = ''
54 54 if request.POST:
... ...