Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

django-3.1 #193

Merged
merged 3 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 1 addition & 3 deletions teamtemp/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions teamtemp/responses/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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())
Expand Down
7 changes: 0 additions & 7 deletions teamtemp/responses/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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'
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion teamtemp/templates/base.html
Original file line number Diff line number Diff line change
@@ -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 %}
Expand Down
2 changes: 1 addition & 1 deletion teamtemp/templates/bvc.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}

{% load bootstrap3 %}
{% load staticfiles %}
{% load static %}

{% block title %}Results {{ survey.id }} {{ bvc_data.team_name }}{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion teamtemp/templates/results.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}

{% load staticfiles %}
{% load static %}

{% block title %}Admin {{ id }} {{ team_name }}{% endblock %}

Expand Down
4 changes: 1 addition & 3 deletions teamtemp/tests/view/test_healthcheck_view.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
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'))
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')