WIP: django-2 compatibility #19
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've created this pull request to add compatibility with django 2.
It seems that adding the correct assets to the form by
forms.Mediais already available in django 1.7 (https://docs.djangoproject.com/en/1.7/topics/forms/media/#media-on-forms), so I guess the patch on the media property should be back-compatible. The nasty code there is needed in order to properly merge the assets, retaining the correct order, so that jquery is loaded and initialised before the dropdown javascript.allow_tagswas deprecated in django 1.10, and substituted withmark_safe, that's taken care of checking theVERSIONvariable in the pull request.I had to comment the
position()method injs/jquery.dropdown.jsbecause it moved the dropdown selector to the top-left corner of the screen.It works in my use case, but it's marked as todo.
Please, let me know if anything is needed to merge this into your repo.