From 6285ddd87c591130c4d49806e370fb6ae3741e25 Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson <frjo@xdeb.org> Date: Tue, 17 Dec 2019 14:51:10 +0100 Subject: [PATCH] Updates to Django 2.2.x LTS and Wagtail 2.7. --- opentech/apply/funds/edit_handlers.py | 5 +++-- opentech/apply/funds/models/submissions.py | 3 +++ opentech/apply/projects/admin.py | 2 +- opentech/apply/projects/tests/test_views.py | 6 +++--- opentech/apply/projects/views/project.py | 2 +- opentech/apply/utils/admin.py | 2 +- requirements.txt | 4 ++-- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/opentech/apply/funds/edit_handlers.py b/opentech/apply/funds/edit_handlers.py index 4c4bcb6ad..80d961ac3 100644 --- a/opentech/apply/funds/edit_handlers.py +++ b/opentech/apply/funds/edit_handlers.py @@ -90,12 +90,13 @@ class ReadOnlyInlinePanel(ReadOnlyPanel): def get_child_edit_handler(self): child_edit_handler = ReadOnlyPanel(self.attr) - return child_edit_handler.bind_to_model(getattr(self.instance, self.attr)) + model = getattr(self.instance, self.attr) + return child_edit_handler.bind_to(model=model) def on_instance_bound(self): values = getattr(self.instance, self.attr).all() child_panel = self.get_child_edit_handler() - self.children = [child_panel.bind_to_instance(value, form=self.form, request=self.request) for value in values] + self.children = [child_panel.bind_to(instance=value, form=self.form, request=self.request) for value in values] class FilteredFieldPanel(FieldPanel): diff --git a/opentech/apply/funds/models/submissions.py b/opentech/apply/funds/models/submissions.py index ee66786c3..857d79b80 100644 --- a/opentech/apply/funds/models/submissions.py +++ b/opentech/apply/funds/models/submissions.py @@ -974,6 +974,9 @@ class AssignedReviewers(models.Model): class Meta: unique_together = (('submission', 'role'), ('submission', 'reviewer')) + def __hash__(self): + return hash(self.pk) + def __str__(self): return f'{self.reviewer}' diff --git a/opentech/apply/projects/admin.py b/opentech/apply/projects/admin.py index eac072de3..81e47b3a7 100644 --- a/opentech/apply/projects/admin.py +++ b/opentech/apply/projects/admin.py @@ -1,4 +1,4 @@ -from django.utils.html import mark_safe +from django.utils.safestring import mark_safe from wagtail.contrib.modeladmin.options import ModelAdmin, ModelAdminGroup from .models import DocumentCategory, ProjectApprovalForm diff --git a/opentech/apply/projects/tests/test_views.py b/opentech/apply/projects/tests/test_views.py index a6364605a..4d0909d57 100644 --- a/opentech/apply/projects/tests/test_views.py +++ b/opentech/apply/projects/tests/test_views.py @@ -966,7 +966,7 @@ class TestApplicantEditPaymentRequestView(BaseViewTestCase): 'date_from': '2018-08-15', 'date_to': '2019-08-15', 'comment': 'test comment', - 'invoice': None, + 'invoice': '', 'receipt_list': [receipt.pk], }) @@ -986,7 +986,7 @@ class TestApplicantEditPaymentRequestView(BaseViewTestCase): 'date_from': '2018-08-15', 'date_to': '2019-08-15', 'comment': 'test comment', - 'invoice': None, + 'invoice': '', 'receipt_list': [], }) @@ -1018,7 +1018,7 @@ class TestStaffEditPaymentRequestView(BaseViewTestCase): 'date_from': '2018-08-15', 'date_to': '2019-08-15', 'comment': 'test comment', - 'invoice': None, + 'invoice': '', 'receipt_list': [receipt.pk], }) diff --git a/opentech/apply/projects/views/project.py b/opentech/apply/projects/views/project.py index 4f5c8966c..4fe570a99 100644 --- a/opentech/apply/projects/views/project.py +++ b/opentech/apply/projects/views/project.py @@ -12,7 +12,7 @@ from django.urls import reverse, reverse_lazy from django.utils import timezone from django.utils.decorators import method_decorator from django.utils.functional import cached_property -from django.utils.text import mark_safe +from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from django.views.generic import ( CreateView, diff --git a/opentech/apply/utils/admin.py b/opentech/apply/utils/admin.py index c45eb156e..4b119ee63 100644 --- a/opentech/apply/utils/admin.py +++ b/opentech/apply/utils/admin.py @@ -1,4 +1,4 @@ -from django.utils.html import mark_safe +from django.utils.safestring import mark_safe class ListRelatedMixin: diff --git a/requirements.txt b/requirements.txt index 29beb3bff..5a2374c5b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,7 +27,7 @@ django-webpack-loader==0.6.0 django_select2==7.1.1 djangorestframework==3.9.2 djangorestframework-api-key==1.3.0 -django==2.1.15 +django==2.2.9 gunicorn==19.9.0 mailchimp3==3.0.9 mistune==0.8.4 @@ -37,6 +37,6 @@ psycopg2==2.7.3.1 reportlab==3.5.31 social_auth_app_django==3.1.0 tomd==0.1.3 -wagtail==2.5.1 +wagtail==2.7.0 wagtail-cache==0.5.2 whitenoise==4.1.4 -- GitLab