From 566157c784e9f815cdae40d7f90bb1442ef8ea9e Mon Sep 17 00:00:00 2001 From: Alpha Diallo Date: Thu, 13 Oct 2022 13:06:33 +0200 Subject: [PATCH 1/4] Upgrade for Python 3.10 --- .idea/.gitignore | 8 ++++ .idea/django-plugins.iml | 22 +++++++++++ .idea/inspectionProfiles/Project_Default.xml | 38 +++++++++++++++++++ .../inspectionProfiles/profiles_settings.xml | 6 +++ .idea/misc.xml | 4 ++ .idea/modules.xml | 8 ++++ .idea/vcs.xml | 6 +++ djangoplugins/models.py | 7 +--- djangoplugins/point.py | 2 +- djangoplugins/signals.py | 4 +- djangoplugins/tests.py | 2 +- djangoplugins/utils.py | 2 +- setup.py | 7 ++-- 13 files changed, 103 insertions(+), 13 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/django-plugins.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/django-plugins.iml b/.idea/django-plugins.iml new file mode 100644 index 0000000..1455bdf --- /dev/null +++ b/.idea/django-plugins.iml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..82c4887 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,38 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..becd76e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..941eb81 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/djangoplugins/models.py b/djangoplugins/models.py index d0fbd94..76e77e2 100644 --- a/djangoplugins/models.py +++ b/djangoplugins/models.py @@ -2,8 +2,7 @@ from dirtyfields import DirtyFieldsMixin from django.db import models -from django.utils.translation import ugettext_lazy as _ -from django.utils.encoding import python_2_unicode_compatible +from django.utils.translation import gettext_lazy as _ from djangoplugins.signals import django_plugin_enabled, django_plugin_disabled from .utils import get_plugin_name, get_plugin_from_string @@ -26,7 +25,6 @@ def get_point(self, point): return self.get(pythonpath=get_plugin_name(point)) -@python_2_unicode_compatible class PluginPoint(models.Model): pythonpath = models.CharField(max_length=255) title = models.CharField(max_length=255) @@ -50,7 +48,6 @@ def get_by_natural_key(self, name): return self.get(pythonpath=name) -@python_2_unicode_compatible class Plugin(DirtyFieldsMixin, models.Model): """ Database representation of a plugin. @@ -96,7 +93,7 @@ def __str__(self): return self.pythonpath def natural_key(self): - return (self.pythonpath,) + return self.pythonpath, def is_active(self): return self.status == ENABLED diff --git a/djangoplugins/point.py b/djangoplugins/point.py index 78f036b..cf6feb2 100644 --- a/djangoplugins/point.py +++ b/djangoplugins/point.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from django import VERSION as django_version -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.core.exceptions import ObjectDoesNotExist from django.utils import six diff --git a/djangoplugins/signals.py b/djangoplugins/signals.py index df8fc73..b32d9d3 100644 --- a/djangoplugins/signals.py +++ b/djangoplugins/signals.py @@ -1,4 +1,4 @@ from django.dispatch import Signal -django_plugin_disabled = Signal(providing_args=["plugin"]) -django_plugin_enabled = Signal(providing_args=["plugin"]) +django_plugin_disabled = Signal() +django_plugin_enabled = Signal() diff --git a/djangoplugins/tests.py b/djangoplugins/tests.py index f611dc3..20d70b5 100644 --- a/djangoplugins/tests.py +++ b/djangoplugins/tests.py @@ -2,7 +2,7 @@ from django import forms from django.test import TestCase -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.utils import six from .fields import PluginChoiceField, PluginModelChoiceField, \ diff --git a/djangoplugins/utils.py b/djangoplugins/utils.py index 941a54c..7fccf60 100644 --- a/djangoplugins/utils.py +++ b/djangoplugins/utils.py @@ -2,7 +2,7 @@ from django.db import connection from django.conf import settings -from django.conf.urls import include, url +from django.urls import include, re_path as url from importlib import import_module diff --git a/setup.py b/setup.py index 0a73345..56ad879 100644 --- a/setup.py +++ b/setup.py @@ -23,8 +23,8 @@ def read_docs(filename): long_description += read_docs('CHANGES.rst') -setup(name='django-plugins', - version='0.3.0', +setup(name='django-plugins-3', + version='0.4.0', author='Lion Krischer', author_email='lion.krischer@googlemail.com', packages=find_packages(exclude=['sample-project']), @@ -35,7 +35,7 @@ def read_docs(filename): url='https://github.com/krischer/django-plugins', download_url='http://pypi.python.org/pypi/django-plugins', license='LGPL', - description='django-plugins.', + description='django-plugins-3.', long_description=long_description, include_package_data=True, exclude_package_data={'': ['sample-project']}, @@ -55,5 +55,6 @@ def read_docs(filename): 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.10', 'Topic :: Software Development :: Libraries :: Python Modules', ]) From 0eeba8feceae7188f59ecd9504d873f2519ef4d7 Mon Sep 17 00:00:00 2001 From: Alpha Diallo Date: Thu, 13 Oct 2022 13:26:11 +0200 Subject: [PATCH 2/4] Compatibility issues with Python >3.6 resolved --- README.md | 4 ++-- djangoplugins/migrations/0001_initial.py | 2 +- djangoplugins/models.py | 2 +- setup.py | 8 ++++++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b8fd268..6248c21 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ reusable. ### Installation -`django-plugins` is currently tested with Python **2.7**, **3.3**, **3.4**, and -**3.5** along with Django versions **1.6**-**1.9**. See the [Travis build +`django-plugins` is currently tested with Python **2.7**, **3.3**, **3.4**, **3.5** and +**3.10** along with Django versions **1.6**-**4.0**. See the [Travis build matrix](https://travis-ci.org/krischer/django-plugins) for detailed information regarding the latest master. diff --git a/djangoplugins/migrations/0001_initial.py b/djangoplugins/migrations/0001_initial.py index 0c3aacd..e37654f 100644 --- a/djangoplugins/migrations/0001_initial.py +++ b/djangoplugins/migrations/0001_initial.py @@ -38,7 +38,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='plugin', name='point', - field=models.ForeignKey(to='djangoplugins.PluginPoint'), + field=models.ForeignKey(to='djangoplugins.PluginPoint', on_delete=models.CASCADE), ), migrations.AlterUniqueTogether( name='plugin', diff --git a/djangoplugins/models.py b/djangoplugins/models.py index 76e77e2..bc6ba1c 100644 --- a/djangoplugins/models.py +++ b/djangoplugins/models.py @@ -72,7 +72,7 @@ class Plugin(DirtyFieldsMixin, models.Model): status Plugin status. """ - point = models.ForeignKey(PluginPoint) + point = models.ForeignKey(PluginPoint, on_delete=models.CASCADE) pythonpath = models.CharField(max_length=255, unique=True) name = models.CharField(max_length=255, null=True, blank=True) title = models.CharField(max_length=255, default='', blank=True) diff --git a/setup.py b/setup.py index 56ad879..97a2245 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ def read_docs(filename): long_description += read_docs('CHANGES.rst') -setup(name='django-plugins-3', +setup(name='django-plugins', version='0.4.0', author='Lion Krischer', author_email='lion.krischer@googlemail.com', @@ -35,7 +35,7 @@ def read_docs(filename): url='https://github.com/krischer/django-plugins', download_url='http://pypi.python.org/pypi/django-plugins', license='LGPL', - description='django-plugins-3.', + description='django-plugins.', long_description=long_description, include_package_data=True, exclude_package_data={'': ['sample-project']}, @@ -55,6 +55,10 @@ def read_docs(filename): 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Topic :: Software Development :: Libraries :: Python Modules', ]) From 89ae9a3401cc0e9c113a594f4679a8cc585d3db4 Mon Sep 17 00:00:00 2001 From: Alpha Diallo Date: Thu, 13 Oct 2022 13:59:33 +0200 Subject: [PATCH 3/4] Repo cleaned + on_delete added --- djangoplugins/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djangoplugins/fields.py b/djangoplugins/fields.py index a345a2f..9d3a334 100644 --- a/djangoplugins/fields.py +++ b/djangoplugins/fields.py @@ -17,7 +17,7 @@ def __init__(self, point=None, *args, **kwargs): } super(PluginField, self).__init__( - to=kwargs.pop("to", Plugin), *args, **kwargs) + to=kwargs.pop("to", Plugin), *args, **kwargs, on_delete=models.CASCADE) class ManyPluginField(models.ManyToManyField): From d8eacb0d9211dcb01a8a8b99ecde1a6030211703 Mon Sep 17 00:00:00 2001 From: Alpha Diallo Date: Thu, 13 Oct 2022 14:05:13 +0200 Subject: [PATCH 4/4] Repo cleaned --- djangoplugins/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djangoplugins/fields.py b/djangoplugins/fields.py index 9d3a334..a345a2f 100644 --- a/djangoplugins/fields.py +++ b/djangoplugins/fields.py @@ -17,7 +17,7 @@ def __init__(self, point=None, *args, **kwargs): } super(PluginField, self).__init__( - to=kwargs.pop("to", Plugin), *args, **kwargs, on_delete=models.CASCADE) + to=kwargs.pop("to", Plugin), *args, **kwargs) class ManyPluginField(models.ManyToManyField):