Skip to content

Commit

Permalink
Add minimal Django 4.0 to let other packages use app-helper (#209)
Browse files Browse the repository at this point in the history
This first step only removes django 4.0 issues in app-helper codebase, as app-helper uses other packages to provide the full feature set, we must wait for external packages to catch on before providing full django 4.0 compatibility
  • Loading branch information
yakky committed Jul 29, 2022
1 parent ca95648 commit b0b8e9c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
15 changes: 9 additions & 6 deletions app_helper/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls import include
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import re_path
from django.views.i18n import JavaScriptCatalog
from django.views.static import serve

Expand All @@ -11,21 +12,23 @@
admin.autodiscover()

urlpatterns = [
url(r"^media/(?P<path>.*)$", serve, {"document_root": settings.MEDIA_ROOT, "show_indexes": True}), # NOQA
url(r"^jsi18n/(?P<packages>\S+?)/$", JavaScriptCatalog.as_view()), # NOQA
re_path(r"^media/(?P<path>.*)$", serve, {"document_root": settings.MEDIA_ROOT, "show_indexes": True}), # NOQA
re_path(r"^jsi18n/(?P<packages>\S+?)/$", JavaScriptCatalog.as_view()), # NOQA
]
i18n_urls = [
url(r"^admin/", admin.site.urls),
re_path(r"^admin/", admin.site.urls),
]

try:
load_from_file("%s.urls" % settings.BASE_APPLICATION)
i18n_urls.append(url(r"^%s/" % settings.BASE_APPLICATION, include("%s.urls" % settings.BASE_APPLICATION))) # NOQA
i18n_urls.append(
re_path(r"^%s/" % settings.BASE_APPLICATION, include("%s.urls" % settings.BASE_APPLICATION))
) # NOQA
except OSError: # pragma: no cover
pass

if settings.USE_CMS:
i18n_urls.append(url(r"^", include("cms.urls"))) # NOQA
i18n_urls.append(re_path(r"^", include("cms.urls"))) # NOQA

urlpatterns += i18n_patterns(*i18n_urls)
urlpatterns += staticfiles_urlpatterns()
1 change: 1 addition & 0 deletions changes/208.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add minimal django 4.0 support
2 changes: 1 addition & 1 deletion tests/test_utils/example1/cms_apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class Example(CMSApp):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils/example1/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class ExampleModel1(models.Model):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils/example2/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class ExampleModel2(models.Model):
Expand Down
6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ envlist =
pep8
pypi-description
towncrier
py{310}-django{32}-{cms311,cms310,nocms,async}
py{310}-django{41,40,32}-{cms311,cms310,nocms,async}
py{39,38,37}-django{32}-{cms311,cms310,cms39,nocms,async}
py{39,38,37}-django{22}-{cms311,cms310,cms39,cms38,cms37,nocms,async}
minversion = 3.22
minversion = 3.23

[testenv]
commands = {env:COMMAND:python} helper.py {posargs}
deps=
django22: django~=2.2.0
django32: django~=3.2.0
django40: django~=4.0.0
django41: django~=4.1rc1
cms37: https://github.com/divio/django-cms/archive/release/3.7.x.zip
cms37: djangocms-text-ckeditor
cms38: https://github.com/divio/django-cms/archive/release/3.8.x.zip
Expand Down

0 comments on commit b0b8e9c

Please sign in to comment.