-
Notifications
You must be signed in to change notification settings - Fork 705
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
base: develop
Are you sure you want to change the base?
Conversation
@@ -16,9 +21,12 @@ | |||
from suit.config import get_config | |||
|
|||
register = template.Library() | |||
if django.VERSION >= (2, 0, 0, 'final', 0): |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
I tested this, and it works for me. 👍 |
|
||
try: | ||
from django.urls import reverse, resolve | ||
except: |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is needed?
No description provided.