From e0f7bc699920e40f6234664b0f57950bb76c5041 Mon Sep 17 00:00:00 2001 From: Robert Loomans Date: Thu, 13 Aug 2020 18:54:09 +1000 Subject: [PATCH 1/3] django-3.1 --- requirements/base.txt | 2 +- teamtemp/headers.py | 4 +--- teamtemp/responses/forms.py | 2 -- teamtemp/responses/models.py | 7 ------- teamtemp/templates/base.html | 2 +- teamtemp/templates/bvc.html | 2 +- teamtemp/templates/results.html | 2 +- 7 files changed, 5 insertions(+), 16 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 3db383d8..90a6ee69 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,4 +1,4 @@ -Django==2.2.13 +Django==3.1 django-bootstrap3==14.1.0 dj-database-url==0.5.0 dj-static==0.0.6 diff --git a/teamtemp/headers.py b/teamtemp/headers.py index 66fc3ba1..5fcdce49 100644 --- a/teamtemp/headers.py +++ b/teamtemp/headers.py @@ -5,8 +5,6 @@ from functools import wraps -from django.utils.decorators import available_attrs - def header(name, value): # View decorator that sets a response header. @@ -21,7 +19,7 @@ def header(name, value): # def get(self, request, ...) # ... def decorator(func): - @wraps(func, assigned=available_attrs(func)) + @wraps(func) def inner(request, *args, **kwargs): response = func(request, *args, **kwargs) response[name] = value diff --git a/teamtemp/responses/forms.py b/teamtemp/responses/forms.py index 6f1e88c4..5617ad8a 100644 --- a/teamtemp/responses/forms.py +++ b/teamtemp/responses/forms.py @@ -6,7 +6,6 @@ from django import forms from django.forms.utils import ErrorList from django.utils import timezone -from django.utils.encoding import python_2_unicode_compatible from django.utils.html import escape from django.utils.safestring import mark_safe @@ -62,7 +61,6 @@ def _check_passwords(obj, cleaned_data): 'New password and confirmation must match') -@python_2_unicode_compatible class ErrorBox(ErrorList): def __str__(self): return mark_safe(self.as_box()) diff --git a/teamtemp/responses/models.py b/teamtemp/responses/models.py index 96b0d85a..fec6f8a0 100644 --- a/teamtemp/responses/models.py +++ b/teamtemp/responses/models.py @@ -8,10 +8,8 @@ from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from django.utils import timezone -from django.utils.encoding import python_2_unicode_compatible -@python_2_unicode_compatible class WordCloudImage(models.Model): class Meta(object): unique_together = ("word_hash", "width", "height") @@ -41,7 +39,6 @@ def clean(self): self.word_list.encode('utf-8')).hexdigest() -@python_2_unicode_compatible class User(models.Model): id = models.CharField(max_length=32, primary_key=True) creation_date = models.DateTimeField(auto_now_add=True) @@ -59,7 +56,6 @@ def _stats_for(query_set): models.Count("id")).order_by()}, query_set -@python_2_unicode_compatible class TeamTemperature(models.Model): TEAM_TEMP = 'TEAMTEMP' DEPT_REGION_SITE = 'DEPT-REGION-SITE' @@ -177,7 +173,6 @@ def __str__(self): self.default_tz) -@python_2_unicode_compatible class TemperatureResponse(models.Model): # class Meta: # unique_together = ("request", "responder", "team_name", "archive_date") @@ -218,7 +213,6 @@ def clean(self): self.word = self.word.lower().strip() -@python_2_unicode_compatible class TeamResponseHistory(models.Model): class Meta(object): verbose_name_plural = "Team response histories" @@ -263,7 +257,6 @@ def clean(self): self.word_list = self.word_list.lower().strip() -@python_2_unicode_compatible class Teams(models.Model): class Meta(object): verbose_name = "Team" diff --git a/teamtemp/templates/base.html b/teamtemp/templates/base.html index 55abc182..1bb9f3a5 100644 --- a/teamtemp/templates/base.html +++ b/teamtemp/templates/base.html @@ -1,7 +1,7 @@ {% extends 'bootstrap3/bootstrap3.html' %} {% load bootstrap3 %} -{% load staticfiles %} +{% load static %} {% block bootstrap3_title %}{% block title %}{% endblock %}{% endblock %} {% block bootstrap3_extra_head %} diff --git a/teamtemp/templates/bvc.html b/teamtemp/templates/bvc.html index 3420be40..797cb711 100644 --- a/teamtemp/templates/bvc.html +++ b/teamtemp/templates/bvc.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% load bootstrap3 %} -{% load staticfiles %} +{% load static %} {% block title %}Results {{ survey.id }} {{ bvc_data.team_name }}{% endblock %} diff --git a/teamtemp/templates/results.html b/teamtemp/templates/results.html index 18046588..243858f2 100644 --- a/teamtemp/templates/results.html +++ b/teamtemp/templates/results.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% load staticfiles %} +{% load static %} {% block title %}Admin {{ id }} {{ team_name }}{% endblock %} From 98e6255dde0e6320d676dfcf6998cc234f840669 Mon Sep 17 00:00:00 2001 From: Robert Loomans Date: Thu, 13 Aug 2020 19:02:06 +1000 Subject: [PATCH 2/3] remove another six import --- teamtemp/tests/view/test_healthcheck_view.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/teamtemp/tests/view/test_healthcheck_view.py b/teamtemp/tests/view/test_healthcheck_view.py index 60b4c7e6..aa67065c 100644 --- a/teamtemp/tests/view/test_healthcheck_view.py +++ b/teamtemp/tests/view/test_healthcheck_view.py @@ -1,9 +1,7 @@ from django.urls import reverse from django.test import TestCase -from django.utils import six from rest_framework import status - class HealthcheckViewTestCases(TestCase): def test_health_check_view(self): response = self.client.get(reverse('healthcheck')) From e2b9590b688e6aba3930a8a5fb1ca25370b01802 Mon Sep 17 00:00:00 2001 From: Robert Loomans Date: Thu, 13 Aug 2020 19:10:14 +1000 Subject: [PATCH 3/3] remove another six import --- teamtemp/tests/view/test_healthcheck_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teamtemp/tests/view/test_healthcheck_view.py b/teamtemp/tests/view/test_healthcheck_view.py index aa67065c..66239640 100644 --- a/teamtemp/tests/view/test_healthcheck_view.py +++ b/teamtemp/tests/view/test_healthcheck_view.py @@ -8,5 +8,5 @@ def test_health_check_view(self): self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response['Content-Type'], 'text/plain') self.assertTemplateNotUsed(response, 'index.html') - self.assertEqual(response.content, six.b('ok')) + self.assertEqual(response.content, b'ok') self.assertContains(response, 'ok')