Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Django 2.0 compatibility problems #651

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

kidsdev
Copy link

@kidsdev kidsdev commented Dec 3, 2017

No description provided.

@@ -16,9 +21,12 @@
from suit.config import get_config

register = template.Library()
if django.VERSION >= (2, 0, 0, 'final', 0):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assignment_tag has been deprecated since 1.9.

Also, you can compare against a "coarse" version, not a very specific one. Makes it a little more readable.

if django.VERSION < (1, 9):
    simple_tag = register.assignment_tag
else:
    simple_tag = register.simple_tag

'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
if django.VERSION >= (2, 0, 0, 'final', 0):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new-style middleware can be used since 1.10.

Copy link
Contributor

@amureki amureki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kidsdev thank you for PR!
I would update travis configuration to be sure that tests are passing.

@grigi
Copy link

grigi commented Jan 10, 2018

I tested this, and it works for me. 👍
Thanks.


try:
from django.urls import reverse, resolve
except:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is far too broad, I suggest to narrow it to ImportError exception:

try:
    ...
except ImportError:
     ...

out_tpl = '<div class="datetime">%s</div>'
return mark_safe(out_tpl % html)

# def format_output(self, rendered_widgets):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants