From 78652b56593cf507ef4e2d8817108a9174843a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Wed, 7 Apr 2021 11:39:11 +0300 Subject: [PATCH] Upgrade Django version to 3.2 --- CHANGELOG.md | 1 + hc/api/admin.py | 9 +++------ hc/payments/admin.py | 2 -- hc/settings.py | 1 + requirements.txt | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24497aa3..2353c8c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. ## v1.20.0 - Unreleased ## Improvements +- Django 3.2 - Rename VictorOps -> Splunk On-Call - Implement email body decoding in the "Ping Details" dialog - Add a "Subject" field in the "Ping Details" dialog diff --git a/hc/api/admin.py b/hc/api/admin.py index a95fa850..2b2c2d80 100644 --- a/hc/api/admin.py +++ b/hc/api/admin.py @@ -55,6 +55,7 @@ class ChecksAdmin(admin.ModelAdmin): return s + @admin.display(description="Schedule") def timeout_schedule(self, obj): if obj.kind == "simple": return format_duration(obj.timeout) @@ -63,8 +64,7 @@ class ChecksAdmin(admin.ModelAdmin): else: return "Unknown" - timeout_schedule.short_description = "Schedule" - + @admin.action(description="Send Alert") def send_alert(self, request, qs): for check in qs: for channel in check.channel_set.all(): @@ -72,8 +72,6 @@ class ChecksAdmin(admin.ModelAdmin): self.message_user(request, "%d alert(s) sent" % qs.count()) - send_alert.short_description = "Send Alert" - class SchemeListFilter(admin.SimpleListFilter): title = "Scheme" @@ -201,11 +199,10 @@ class ChannelsAdmin(admin.ModelAdmin): return f'   {obj.kind}{note}' + @admin.display(boolean=True) def ok(self, obj): return False if obj.last_error else True - ok.boolean = True - @admin.register(Notification) class NotificationsAdmin(admin.ModelAdmin): diff --git a/hc/payments/admin.py b/hc/payments/admin.py index aeacd2a6..f284de0b 100644 --- a/hc/payments/admin.py +++ b/hc/payments/admin.py @@ -42,8 +42,6 @@ class SubsAdmin(admin.ModelAdmin): return "" - profile.allow_tags = True - def cancel(self, request, qs): for sub in qs.all(): sub.cancel() diff --git a/hc/settings.py b/hc/settings.py index 14d31723..2f24b3d7 100644 --- a/hc/settings.py +++ b/hc/settings.py @@ -106,6 +106,7 @@ TEST_RUNNER = "hc.api.tests.CustomRunner" # Default database engine is SQLite. So one can just check out code, # install requirements.txt and do manage.py runserver and it works +DEFAULT_AUTO_FIELD = "django.db.models.AutoField" DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", diff --git a/requirements.txt b/requirements.txt index 4b28a487..7ae66059 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ cron-descriptor==1.2.24 croniter==1.0.8 -Django==3.1.7 +Django==3.2 django-compressor==2.4 fido2==0.9.1 psycopg2==2.8.6