Skip to content

Commit

Permalink
feat: Added Django 3.2 and Python 3.8 and 3.9 support (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiky30 authored Mar 24, 2022
1 parent d1308bb commit b78bd29
Show file tree
Hide file tree
Showing 23 changed files with 195 additions and 202 deletions.
184 changes: 93 additions & 91 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,127 +1,128 @@
version: 2.0

py35default: &py35default
py37default: &py37default
docker:
- image: circleci/python:3.5
- image: circleci/python:3.7
steps:
- setup_remote_docker:
docker_layer_caching: false
- checkout
- attach_workspace:
at: /tmp/images
- run: docker load -i /tmp/images/py35.tar || true
- run: docker run py35 tox -e $CIRCLE_STAGE
- run: docker load -i /tmp/images/py37.tar || true
- run: docker run py37 tox -e $CIRCLE_STAGE

py36default: &py36default
py38default: &py38default
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
steps:
- setup_remote_docker:
docker_layer_caching: false
- checkout
- attach_workspace:
at: /tmp/images
- run: docker load -i /tmp/images/py36.tar || true
- run: docker run py36 tox -e $CIRCLE_STAGE
- run: docker load -i /tmp/images/py38.tar || true
- run: docker run py38 tox -e $CIRCLE_STAGE

py37default: &py37default
py39default: &py39default
docker:
- image: circleci/python:3.7
- image: circleci/python:3.9
steps:
- setup_remote_docker:
docker_layer_caching: false
- checkout
- attach_workspace:
at: /tmp/images
- run: docker load -i /tmp/images/py37.tar || true
- run: docker run py37 tox -e $CIRCLE_STAGE
- run: docker load -i /tmp/images/py39.tar || true
- run: docker run py39 tox -e $CIRCLE_STAGE


py35_requires: &py35_requires
py37_requires: &py37_requires
requires:
- py35_base
- py37_base

py36_requires: &py36_requires
py38_requires: &py38_requires
requires:
- py36_base
- py38_base

py37_requires: &py37_requires
py39_requires: &py39_requires
requires:
- py37_base
- py39_base


jobs:
py35_base:
py37_base:
docker:
- image: circleci/python:3.5
- image: circleci/python:3.7
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: false
- run: docker build -f .circleci/Dockerfile --build-arg PYTHON_VERSION=3.5 -t py35 .
- run: docker build -f .circleci/Dockerfile --build-arg PYTHON_VERSION=3.7 -t py37 .
- run: mkdir images
- run: docker save -o images/py35.tar py35
- run: docker save -o images/py37.tar py37
- persist_to_workspace:
root: images
paths: py35.tar
py36_base:
paths: py37.tar
py38_base:
docker:
- image: circleci/python:3.6
- image: circleci/python:3.8
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: false
- run: docker build -f .circleci/Dockerfile --build-arg PYTHON_VERSION=3.6 -t py36 .
- run: docker build -f .circleci/Dockerfile --build-arg PYTHON_VERSION=3.8 -t py38 .
- run: mkdir images
- run: docker save -o images/py36.tar py36
- run: docker save -o images/py38.tar py38
- persist_to_workspace:
root: images
paths: py36.tar
py37_base:
paths: py38.tar
py39_base:
docker:
- image: circleci/python:3.7
- image: circleci/python:3.9
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: false
- run: docker build -f .circleci/Dockerfile --build-arg PYTHON_VERSION=3.7 -t py37 .
- run: docker build -f .circleci/Dockerfile --build-arg PYTHON_VERSION=3.9 -t py39 .
- run: mkdir images
- run: docker save -o images/py37.tar py37
- run: docker save -o images/py39.tar py39
- persist_to_workspace:
root: images
paths: py37.tar
paths: py39.tar

flake8:
<<: *py35default
<<: *py38default
isort:
<<: *py35default
py36-dj111-sqlite-cms40-default:
<<: *py36default


py35-dj20-sqlite-cms40-default:
<<: *py35default
py35-dj20-sqlite-cms40-versioning:
<<: *py35default
py36-dj20-sqlite-cms40-default:
<<: *py36default
<<: *py38default

py36-dj21-sqlite-cms40-default:
<<: *py36default
py36-dj21-sqlite-cms40-versioning:
<<: *py36default

py35-dj22-sqlite-cms40-default:
<<: *py35default
py35-dj22-sqlite-cms40-versioning:
<<: *py35default
py36-dj22-sqlite-cms40-default:
<<: *py36default
py36-dj22-sqlite-cms40-versioning:
<<: *py36default
py37-dj22-sqlite-cms40-default:
# django 2.2
py37-dj22-sqlite-default:
<<: *py37default
py37-dj22-sqlite-cms40-versioning:
py37-dj22-sqlite-versioning:
<<: *py37default

py38-dj22-sqlite-default:
<<: *py38default
py38-dj22-sqlite-versioning:
<<: *py38default
py39-dj22-sqlite-default:
<<: *py39default
py39-dj22-sqlite-versioning:
<<: *py39default

# django 3.2
py37-dj32-sqlite-default:
<<: *py37default
py37-dj32-sqlite-versioning:
<<: *py37default
py38-dj32-sqlite-default:
<<: *py38default
py38-dj32-sqlite-versioning:
<<: *py38default
py39-dj32-sqlite-default:
<<: *py39default
py39-dj32-sqlite-versioning:
<<: *py39default


#######################
Expand All @@ -130,49 +131,50 @@ workflows:
version: 2
build:
jobs:
- py35_base
- py36_base
- py37_base
- py38_base
- py39_base
- flake8:
requires:
- py35_base
- py38_base
- isort:
requires:
- py35_base
- py36-dj111-sqlite-cms40-default:
- py38_base
# django 2.2
- py37-dj22-sqlite-default:
requires:
- py37_base
- py37-dj22-sqlite-versioning:
requires:
- py36_base
- py35-dj20-sqlite-cms40-default:
- py37_base
- py38-dj22-sqlite-default:
requires:
- py35_base
- py35-dj20-sqlite-cms40-versioning:
- py38_base
- py38-dj22-sqlite-versioning:
requires:
- py35_base
- py36-dj20-sqlite-cms40-default:
- py38_base
- py39-dj22-sqlite-default:
requires:
- py36_base


- py36-dj21-sqlite-cms40-default:
- py39_base
- py39-dj22-sqlite-versioning:
requires:
- py36_base
- py36-dj21-sqlite-cms40-versioning:
- py39_base
# django 3.2
- py37-dj32-sqlite-default:
requires:
- py36_base


- py35-dj22-sqlite-cms40-versioning:
- py37_base
- py37-dj32-sqlite-versioning:
requires:
- py35_base
- py36-dj22-sqlite-cms40-default:
- py37_base
- py38-dj32-sqlite-default:
requires:
- py36_base
- py36-dj22-sqlite-cms40-versioning:
- py38_base
- py38-dj32-sqlite-versioning:
requires:
- py36_base
- py37-dj22-sqlite-cms40-default:
- py38_base
- py39-dj32-sqlite-default:
requires:
- py37_base
- py37-dj22-sqlite-cms40-versioning:
- py39_base
- py39-dj32-sqlite-versioning:
requires:
- py37_base
- py39_base
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ local.sqlite
.coverage
htmlcov
.python-version
venv*
2 changes: 1 addition & 1 deletion djangocms_alias/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class AliasConfig(AppConfig):
Expand Down
3 changes: 2 additions & 1 deletion djangocms_alias/cms_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ class AliasCMSConfig(CMSAppConfig):
djangocms_versioning_enabled = getattr(
settings, 'VERSIONING_ALIAS_MODELS_ENABLED', True)
if djangocms_versioning_enabled:
from djangocms_versioning.datastructures import VersionableItem
from cms.utils.i18n import get_language_tuple

from djangocms_versioning.datastructures import VersionableItem

versioning = [
VersionableItem(
content_model=AliasContent,
Expand Down
2 changes: 1 addition & 1 deletion djangocms_alias/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.utils.translation import (
get_language_from_request,
ugettext_lazy as _,
gettext_lazy as _,
)

from cms.plugin_base import CMSPluginBase, PluginMenuItem
Expand Down
9 changes: 5 additions & 4 deletions djangocms_alias/cms_toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from copy import copy

from django.urls import NoReverseMatch
from django.utils.encoding import force_text
from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils.encoding import force_str
from django.utils.translation import gettext, gettext_lazy as _

from cms.cms_toolbars import (
ADMIN_MENU_IDENTIFIER,
Expand Down Expand Up @@ -134,7 +134,7 @@ def get_insert_position(cls, admin_menu, item_name):
items = admin_menu.get_items()[start.index + 1: end.index]
for idx, item in enumerate(items):
try:
if force_text(item_name.lower()) < force_text(item.name.lower()): # noqa: E501
if force_str(item_name.lower()) < force_str(item.name.lower()): # noqa: E501
return idx + start.index + 1
except AttributeError:
# Some item types do not have a 'name' attribute.
Expand All @@ -157,10 +157,11 @@ def enable_create_wizard_button(self):
# There will always be this button, because we are in the context of
# alias app views
create_wizard_button = [
button for button in buttons if button.name == ugettext('Create')
button for button in buttons if button.name == gettext('Create')
][0]

from cms.wizards.wizard_pool import entry_choices

# we enable this button when user has permissions to perform actions on
# wizard
enable_create_wizard_button = bool(
Expand Down
2 changes: 1 addition & 1 deletion djangocms_alias/cms_wizards.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from cms.utils.permissions import get_model_permission_codename
from cms.wizards.wizard_base import Wizard
Expand Down
2 changes: 1 addition & 1 deletion djangocms_alias/filters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from cms.utils.i18n import get_language_tuple, get_site_language_from_request

Expand Down
2 changes: 1 addition & 1 deletion djangocms_alias/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RelatedFieldWidgetWrapper,
)
from django.db import transaction
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from cms.models import CMSPlugin, Placeholder
from cms.utils.permissions import (
Expand Down
2 changes: 1 addition & 1 deletion djangocms_alias/internal_search.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from cms.toolbar.utils import get_toolbar_from_request

Expand Down
11 changes: 7 additions & 4 deletions djangocms_alias/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from django.contrib.sites.models import Site
from django.db import models, transaction
from django.db.models import F, Q
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from cms.api import add_plugin
from cms.models import CMSPlugin, Placeholder
Expand Down Expand Up @@ -161,7 +161,10 @@ def get_name(self, language=None):

def get_absolute_url(self, language=None):
if is_versioning_enabled():
from djangocms_versioning.helpers import version_list_url_for_grouper
from djangocms_versioning.helpers import (
version_list_url_for_grouper,
)

return version_list_url_for_grouper(self)
content = self.get_content(language=language)
if content:
Expand Down Expand Up @@ -399,7 +402,7 @@ class Meta:
verbose_name_plural = _('alias plugin models')

def __str__(self):
return force_text(self.alias.name)
return force_str(self.alias.name)

def is_recursive(self, language=None):
# When versioning is enabled it will only get published content
Expand Down
Loading

0 comments on commit b78bd29

Please sign in to comment.