Skip to content

Commit

Permalink
Merge pull request #10 from CTPUG/feature/support_django_3.0
Browse files Browse the repository at this point in the history
Feature/support django 3.0
  • Loading branch information
drnlm authored Mar 20, 2020
2 parents ad9b98e + 492ab5e commit 7315bde
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 34 deletions.
18 changes: 6 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,30 @@ addons:
- python3.8-dev
- python3.8-venv
env:
- TOXENV=py27-1.8
- TOXENV=py27-1.9
- TOXENV=py27-1.10
- TOXENV=py35-1.9
- TOXENV=py35-1.10
- TOXENV=py35-1.11
- TOXENV=py35-2.0
- TOXENV=py35-2.1
- TOXENV=py35-2.2
- TOXENV=py36-1.9
- TOXENV=py36-1.10
- TOXENV=py36-1.11
- TOXENV=py36-2.0
- TOXENV=py36-2.1
- TOXENV=py36-2.2
- TOXENV=py36-3.0
- TOXENV=py37-1.9
- TOXENV=py37-1.10
- TOXENV=py36-djdev
- TOXENV=py37-1.11
- TOXENV=py37-2.0
- TOXENV=py37-2.1
- TOXENV=py37-2.2
- TOXENV=py37-3.0
- TOXENV=py37-djdev
- TOXENV=py38-2.2
- TOXENV=py38-3.0
- TOXENV=py38-djdev
matrix:
allow_failures:
- env: TOXENV=py36-3.0
- env: TOXENV=py37-3.0
- env: TOXENV=py38-3.0
- env: TOXENV=py36-djdev
- env: TOXENV=py37-djdev
- env: TOXENV=py38-djdev
install:
- pip install tox
script:
Expand Down
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ To use ``django-markitup`` in your Django project:
Dependencies
------------

``django-markitup`` 4.x requires `Django`_ 1.11 or later and Python 3.5+.

``django-markitup`` 3.x requires `Django`_ 1.8 or later and Python 2.7+ or 3.4+.

``django-markitup`` 2.x requires `Django`_ 1.4 or later and Python 2.6+ or 3.3+.
Expand Down
10 changes: 3 additions & 7 deletions markitup/fields.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
from __future__ import unicode_literals
from functools import partial

from django.conf import settings
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.safestring import mark_safe, SafeData
from django.utils.functional import curry
from django.core.exceptions import ImproperlyConfigured
from markitup import widgets

_rendered_field_name = lambda name: '_%s_rendered' % name

def _get_render_func(dotted_path, **kwargs):
# Don't coerce to unicode on python 2
(module, func) = dotted_path.rsplit(str('.'), 1)
module, func = dotted_path.rsplit('.', 1)
func = getattr(__import__(module, {}, {}, [func]), func)
return curry(func, **kwargs)
return partial(func, **kwargs)

try:
render_func = _get_render_func(settings.MARKITUP_FILTER[0],
Expand All @@ -25,7 +22,6 @@ def _get_render_func(dotted_path, **kwargs):
except AttributeError as e:
raise ImproperlyConfigured("MARKITUP_FILTER setting is required")

@python_2_unicode_compatible
class Markup(SafeData):
def __init__(self, instance, field_name, rendered_field_name):
# instead of storing actual values store a reference to the instance
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _static_files(prefix):

setup(
name='django-markitup',
version='3.7.0',
version='4.0.0',
description='Markup handling for Django using the MarkItUp! universal markup editor',
long_description=long_description,
author='Carl Meyer',
Expand All @@ -31,7 +31,6 @@ def _static_files(prefix):
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
Expand All @@ -41,7 +40,7 @@ def _static_files(prefix):
],
zip_safe=False,
test_suite='runtests.runtests',
tests_require='Django>=1.8',
tests_require='Django>=1.11',
package_data={'markitup': ['templates/markitup/*.html'] +
_static_files('static')}
)
4 changes: 0 additions & 4 deletions tests/models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from __future__ import unicode_literals

from django.db import models
from django.utils.encoding import python_2_unicode_compatible

from markitup.fields import MarkupField


@python_2_unicode_compatible
class Post(models.Model):
title = models.CharField(max_length=50)
body = MarkupField()
Expand Down
15 changes: 7 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
[tox]
envlist=
py27-1.{8,9,10}
py35-1.{9,10,11}
py35-1.11
py35-2.{0,1,2}
py36-1.{9,10,11}
py36-1.11
py36-2.{0,1,2}
py36-3.0
py37-1.{9,10,11}
py36-djdev
py37-1.11
py37-2.{0,1,2}
py37-3.0
py37-djdev
py38-2.2
py38-3.0
py38-djdev

[testenv]
basepython =
py27: python2.7
py35: python3.5
py36: python3.6
py37: python3.7
py38: python3.8
commands=python setup.py test
deps =
1.8: Django>=1.8,<1.9
1.9: Django>=1.9,<1.10
1.10: Django>=1.10,<1.11
1.11: Django>=1.11,<2
2.0: Django>=2.0,<2.1
2.1: Django>=2.1,<2.2
2.2: Django>=2.2,<3
3.0: Django>=3.0,<3.1
djdev: https://github.com/django/django/archive/master.tar.gz

0 comments on commit 7315bde

Please sign in to comment.