mirror of
https://github.com/django-components/django-components.git
synced 2025-08-03 13:58:16 +00:00
Remove support for Python < 3.6 and Django < 2.2.
This commit is contained in:
parent
ab7e97658f
commit
2c95b0930f
6 changed files with 22 additions and 67 deletions
16
README.md
16
README.md
|
@ -106,14 +106,14 @@ TEMPLATES = [
|
||||||
|
|
||||||
# Compatiblity
|
# Compatiblity
|
||||||
|
|
||||||
| Python version | Django version |
|
Django-components supports all officially supported versions of Django and Python.
|
||||||
|----------------|-------------------------------|
|
|
||||||
| 2.7 | 1.11 |
|
| Python version | Django version |
|
||||||
| 3.5 | 1.11, 2.0, 2.1, 2.2 |
|
|----------------|--------------------------|
|
||||||
| 3.6 | 1.11, 2.0, 2.1, 2.2, 3.0, 3.1 |
|
| 3.6 | 2.2, 3.0, 3.1 |
|
||||||
| 3.7 | 1.11, 2.0, 2.1, 2.2, 3.0, 3.1 |
|
| 3.7 | 2.2, 3.0, 3.1 |
|
||||||
| 3.8 | 2.1, 2.2, 3.0, 3.1 |
|
| 3.8 | 2.2, 3.0, 3.1 |
|
||||||
| 3.9 | 2.1, 2.2, 3.0, 3.1 |
|
| 3.9 | 2.2, 3.0, 3.1 |
|
||||||
|
|
||||||
# Create your first component
|
# Create your first component
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ from time import perf_counter
|
||||||
from django.template import Context, Template
|
from django.template import Context, Template
|
||||||
|
|
||||||
from django_components import component
|
from django_components import component
|
||||||
|
|
||||||
from tests.django_test_setup import * # NOQA
|
from tests.django_test_setup import * # NOQA
|
||||||
from tests.testutils import Django111CompatibleSimpleTestCase as SimpleTestCase
|
from tests.testutils import Django111CompatibleSimpleTestCase as SimpleTestCase
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from itertools import chain
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.forms.widgets import MediaDefiningClass
|
from django.forms.widgets import MediaDefiningClass
|
||||||
from django.template.base import NodeList
|
from django.template.base import NodeList, TokenType
|
||||||
from django.template.loader import get_template
|
from django.template.loader import get_template
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from six import with_metaclass
|
from six import with_metaclass
|
||||||
|
@ -12,17 +12,6 @@ from six import with_metaclass
|
||||||
# Allow "component.AlreadyRegistered" instead of having to import these everywhere
|
# Allow "component.AlreadyRegistered" instead of having to import these everywhere
|
||||||
from django_components.component_registry import AlreadyRegistered, ComponentRegistry, NotRegistered # noqa
|
from django_components.component_registry import AlreadyRegistered, ComponentRegistry, NotRegistered # noqa
|
||||||
|
|
||||||
# Django < 2.1 compatibility
|
|
||||||
try:
|
|
||||||
from django.template.base import TokenType
|
|
||||||
except ImportError:
|
|
||||||
from django.template.base import TOKEN_BLOCK, TOKEN_TEXT, TOKEN_VAR
|
|
||||||
|
|
||||||
class TokenType:
|
|
||||||
TEXT = TOKEN_TEXT
|
|
||||||
VAR = TOKEN_VAR
|
|
||||||
BLOCK = TOKEN_BLOCK
|
|
||||||
|
|
||||||
|
|
||||||
class Component(with_metaclass(MediaDefiningClass)):
|
class Component(with_metaclass(MediaDefiningClass)):
|
||||||
|
|
||||||
|
|
|
@ -1,39 +1,12 @@
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
import django
|
|
||||||
from django import template
|
from django import template
|
||||||
from django.template.base import Node, NodeList, TemplateSyntaxError
|
from django.template.base import Node, NodeList, TemplateSyntaxError, TokenType
|
||||||
from django.template.library import parse_bits
|
from django.template.library import parse_bits
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
from django_components.component import registry
|
from django_components.component import registry
|
||||||
|
|
||||||
# Django < 2.1 compatibility
|
|
||||||
try:
|
|
||||||
from django.template.base import TokenType
|
|
||||||
except ImportError:
|
|
||||||
from django.template.base import TOKEN_BLOCK, TOKEN_TEXT, TOKEN_VAR
|
|
||||||
|
|
||||||
class TokenType:
|
|
||||||
TEXT = TOKEN_TEXT
|
|
||||||
VAR = TOKEN_VAR
|
|
||||||
BLOCK = TOKEN_BLOCK
|
|
||||||
|
|
||||||
|
|
||||||
# Django < 2.0 compatibility
|
|
||||||
if django.VERSION > (2, 0):
|
|
||||||
PARSE_BITS_DEFAULTS = {
|
|
||||||
"varkw": [],
|
|
||||||
"defaults": None,
|
|
||||||
"kwonly": [],
|
|
||||||
"kwonly_defaults": None,
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
PARSE_BITS_DEFAULTS = {
|
|
||||||
"varkw": [],
|
|
||||||
"defaults": None,
|
|
||||||
}
|
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
COMPONENT_CONTEXT_KEY = "component_context"
|
COMPONENT_CONTEXT_KEY = "component_context"
|
||||||
|
@ -212,7 +185,10 @@ def parse_component_with_args(parser, bits, tag_name):
|
||||||
takes_context=False,
|
takes_context=False,
|
||||||
name=tag_name,
|
name=tag_name,
|
||||||
varargs=True,
|
varargs=True,
|
||||||
**PARSE_BITS_DEFAULTS
|
varkw=[],
|
||||||
|
defaults=None,
|
||||||
|
kwonly=[],
|
||||||
|
kwonly_defaults=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert tag_name == tag_args[0].token, "Internal error: Expected tag_name to be {}, but it was {}".format(
|
assert tag_name == tag_args[0].token, "Internal error: Expected tag_name to be {}, but it was {}".format(
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -20,9 +20,7 @@ setup(
|
||||||
keywords=["django", "components", "css", "js", "html"],
|
keywords=["django", "components", "css", "js", "html"],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Programming Language :: Python :: 2.7",
|
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.5",
|
|
||||||
"Programming Language :: Python :: 3.6",
|
"Programming Language :: Python :: 3.6",
|
||||||
"Programming Language :: Python :: 3.7",
|
"Programming Language :: Python :: 3.7",
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
|
|
23
tox.ini
23
tox.ini
|
@ -1,29 +1,22 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist =
|
envlist =
|
||||||
py27-django111
|
py36-django{22,30,31}
|
||||||
py35-django{111,20,21,22}
|
py37-django{22,30,31}
|
||||||
py36-django{111,20,21,22,30,31}
|
py38-django{22,30,31}
|
||||||
py37-django{111,20,21,22,30,31}
|
py39-django{22,30,31}
|
||||||
py38-django{21,22,30,31}
|
|
||||||
py39-django{21,22,30,31}
|
|
||||||
flake8
|
flake8
|
||||||
isort
|
isort
|
||||||
|
|
||||||
[gh-actions]
|
[gh-actions]
|
||||||
2.7 = py27-django111
|
3.6 = py36-django{22,30,31}
|
||||||
3.5 = py35-django{111,20,21,22}
|
3.7 = py37-django{22,30,31}
|
||||||
3.6 = py36-django{111,20,21,22,30,31}
|
3.8 = py38-django{22,30,31}
|
||||||
3.7 = py37-django{111,20,21,22,30,31}
|
3.9 = py39-django{22,30,31}, flake8, isort
|
||||||
3.8 = py38-django{21,22,30,31}
|
|
||||||
3.9 = py39-django{21,22,30,31}, flake8, isort
|
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps =
|
deps =
|
||||||
pytest
|
pytest
|
||||||
pytest-xdist
|
pytest-xdist
|
||||||
django111: Django>=1.11,<2.0
|
|
||||||
django20: Django>=2.0,<2.1
|
|
||||||
django21: Django>=2.1,<2.2
|
|
||||||
django22: Django>=2.2,<2.3
|
django22: Django>=2.2,<2.3
|
||||||
django30: Django>=3.0,<3.1
|
django30: Django>=3.0,<3.1
|
||||||
django31: Django>=3.1,<3.2
|
django31: Django>=3.1,<3.2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue