diff --git a/.travis.yml b/.travis.yml index 6ffa67a..939202b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,9 @@ env: - TOXENV=py35-2.0.X - TOXENV=py36-2.0.X + - TOXENV=py35-2.1.X + - TOXENV=py36-2.1.X + - TOXENV=coverage - TOXENV=docs - TOXENV=qunit diff --git a/package.json b/package.json index 0625714..06d9919 100644 --- a/package.json +++ b/package.json @@ -21,9 +21,9 @@ }, "dependencies": { "backbone": ">=1.2 <1.3", - "codemirror": ">=5.10 <6.0", + "codemirror": "^5.40.0", "jquery": ">=2.2 <2.3", - "jshint": "^2.9.5", + "jshint": "^2.9.6", "less": "^2.7.3", "phantomjs-prebuilt": "^2.1.16", "underscore": ">=1.8 <1.9" diff --git a/scribbler/models.py b/scribbler/models.py index b9a2ccf..f0787df 100644 --- a/scribbler/models.py +++ b/scribbler/models.py @@ -5,6 +5,10 @@ from django.db import models from django.db.models.signals import post_save, post_delete, pre_save from django.dispatch import receiver +try: + from django.urls import reverse +except ImportError: + from django.core.urlresolvers import reverse try: from django.utils.six import PY3 except ImportError: @@ -35,16 +39,14 @@ def __str__(self): class Meta(object): unique_together = ('slug', 'url') - @models.permalink def get_save_url(self): if self.pk: - return ('edit-scribble', (), {'scribble_id': self.pk}) + return reverse('edit-scribble', kwargs={'scribble_id': self.pk}) else: - return ('create-scribble', (), {}) + return reverse('create-scribble') - @models.permalink def get_delete_url(self): - return ('delete-scribble', (), {'scribble_id': self.pk}) + return reverse('delete-scribble', kwargs={'scribble_id': self.pk}) @receiver(post_save, sender=Scribble) diff --git a/scribbler/templatetags/scribbler_tags.py b/scribbler/templatetags/scribbler_tags.py index c2b660e..af17c46 100644 --- a/scribbler/templatetags/scribbler_tags.py +++ b/scribbler/templatetags/scribbler_tags.py @@ -14,6 +14,16 @@ from scribbler.views import build_scribble_context +try: + TOKEN_VAR = template_base.TokenType.VAR + TOKEN_BLOCK = template_base.TokenType.BLOCK + TOKEN_COMMENT = template_base.TokenType.COMMENT +except AttributeError: + TOKEN_VAR = template_base.TOKEN_VAR + TOKEN_BLOCK = template_base.TOKEN_BLOCK + TOKEN_COMMENT = template_base.TOKEN_COMMENT + + register = template.Library() @@ -88,24 +98,25 @@ def render(self, context): return wrapper_template.render(context_data, request) + def rebuild_template_string(tokens): "Reconstruct the original template from a list of tokens." result = '' for token in tokens: value = token.contents - if token.token_type == template_base.TOKEN_VAR: + if token.token_type == TOKEN_VAR: value = '{0} {1} {2}'.format( template_base.VARIABLE_TAG_START, value, template_base.VARIABLE_TAG_END, ) - elif token.token_type == template_base.TOKEN_BLOCK: + elif token.token_type == TOKEN_BLOCK: value = '{0} {1} {2}'.format( template_base.BLOCK_TAG_START, value, template_base.BLOCK_TAG_END, ) - elif token.token_type == template_base.TOKEN_COMMENT: + elif token.token_type == TOKEN_COMMENT: value = '{0} {1} {2}'.format( template_base.COMMENT_TAG_START, value, diff --git a/scribbler/tests/urls.py b/scribbler/tests/urls.py index 8734714..4fd1b87 100644 --- a/scribbler/tests/urls.py +++ b/scribbler/tests/urls.py @@ -24,8 +24,13 @@ def test_500(request, exception=None): 'packages': ('scribbler', ), } +try: + login_url = url(r'^test/', auth_views.LoginView.as_view(template_name='test.html')) +except AttributeError: + login_url = url(r'^test/', auth_views.login, {'template_name': 'test.html'}) + urlpatterns = [ url(r'^scribble/', include('scribbler.urls')), url(r'^jsi18n/$', javascript_catalog, js_info_dict, name='jsi18n'), - url(r'^test/', auth_views.login, {'template_name': 'test.html'}), + login_url, ] diff --git a/tox.ini b/tox.ini index 429fb7c..571109b 100644 --- a/tox.ini +++ b/tox.ini @@ -11,6 +11,7 @@ envlist = {py27,py34,py35}-1.10.X, {py27,py34,py35,py36}-1.11.X, {py34,py35,py36}-{2.0}.X, + {py35,py36}-{2.1}.X, coverage,docs,qunit [testenv] @@ -25,6 +26,7 @@ deps = 1.10.X: Django>=1.10,<1.11 1.11.X: Django>=1.11,<2.0 2.0.X: Django>=2.0,<2.1 + 2.1.X: Django>=2.1,<2.2 Jinja2 selenium whitelist_externals = make