1
0
Files
python-HyperKitty/hyperkitty-fix-tests.patch
Markéta Machová 803580dbbf Accepting request 856002 from home:gladiac:mailman3
- Added hyperkitty-qcluster.service
- Added hyperkitty-runjob.service and hyperkitty-runjob.timer
- Create a HyperKitty-web package with webroot files
- Create a HyperKitty-web-uwsgi with uwsgi configuration
- Added postorius-settings.patch
  * Sets the FHS default paths
- Added hyperkitty-fix-tests.patch
  * Make migration compatible with django >= 3.1
- Added rpmlint config

OBS-URL: https://build.opensuse.org/request/show/856002
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:mailman/python-HyperKitty?expand=0&rev=27
2020-12-15 15:11:10 +00:00

79 lines
2.8 KiB
Diff

From 0e46371f0f2aab8618aa2852ea6f63c245e16927 Mon Sep 17 00:00:00 2001
From: David Runge <dave@sleepmap.de>
Date: Sat, 7 Nov 2020 01:14:04 +0000
Subject: [PATCH] Make migration compatible with django >= 3.1
hyperkitty/migrations/0013_mailinglist_id_1.py:
With django >= 3.1 the state.models.fields are represented as dicts,
while with django < 3.1 they are represented as lists.
Accomodate both use-cases by checking the type of the fields before
trying to add to them.
Fixes #329
---
.../migrations/0013_mailinglist_id_1.py | 33 ++++++++++--
setup.py | 2 +-
tox.ini | 5 +-
4 files changed, 62 insertions(+), 28 deletions(-)
diff --git a/hyperkitty/migrations/0013_mailinglist_id_1.py b/hyperkitty/migrations/0013_mailinglist_id_1.py
index f460daf9..d55afed5 100644
--- a/hyperkitty/migrations/0013_mailinglist_id_1.py
+++ b/hyperkitty/migrations/0013_mailinglist_id_1.py
@@ -16,10 +16,35 @@ class MailingListPrimaryKey(migrations.AlterField):
)
def state_forwards(self, app_label, state):
- state.models[app_label, self.model_name_lower].fields.insert(0, (
- "id", models.AutoField(
- name="id", auto_created=True, primary_key=True, serialize=False,
- verbose_name='ID')))
+ # django < 3.1
+ if type(state.models[app_label, self.model_name_lower].fields) is list:
+ state.models[app_label, self.model_name_lower].fields.insert(
+ 0,
+ (
+ "id",
+ models.AutoField(
+ name="id",
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name='ID'
+ )
+ )
+ )
+ # django >= 3.1
+ else:
+ state.models[app_label, self.model_name_lower].fields.update(
+ {
+ "id":
+ models.AutoField(
+ name="id",
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name='ID',
+ )
+ }
+ )
super(MailingListPrimaryKey, self).state_forwards(app_label, state)
def database_forwards(self, app_label, schema_editor, from_state, to_state):
diff --git a/setup.py b/setup.py
index cb058659..0968c676 100755
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,7 @@ with open('hyperkitty/__init__.py') as fp:
# Requirements
REQUIRES = [
- "Django>=2.0,<3.1",
+ "Django>=2.2,<3.2",
"django_mailman3>=1.3.3",
"django-gravatar2>=1.0.6",
"djangorestframework>=3.0.0",
--
GitLab