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

Add Django 1.9+ compaibility #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion wpadmin/menu/menus.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse

try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.conf import settings

from wpadmin.utils import get_admin_site, get_admin_site_name
Expand Down
10 changes: 8 additions & 2 deletions wpadmin/menu/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
"""
from fnmatch import fnmatch

from django.utils.importlib import import_module
from django.core.urlresolvers import reverse
try:

from django.utils.module_loading import import_module
from django.urls import reverse
except ImportError:

from django.utils.importlib import import_module
from django.core.urlresolvers import reverse

from wpadmin.utils import (
get_wpadmin_settings, get_admin_site, get_admin_site_name)
Expand Down
2 changes: 1 addition & 1 deletion wpadmin/templates/admin/base.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load admin_static wpadmin_tags wpadmin_menu_tags %}{% load firstof from future %}<!DOCTYPE html>
{% load admin_static wpadmin_tags wpadmin_menu_tags %}<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
{# WP Admin start #}
Expand Down
10 changes: 10 additions & 0 deletions wpadmin/templatetags/future.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# templatetags/future.py
from django.template import Library
from django.template.defaulttags import cycle as cycle_original

register = Library()

@register.tag
def cycle(*args, **kwargs):
''' A stub to get SortableTabularInline to work '''
return cycle_original(*args, **kwargs)
5 changes: 4 additions & 1 deletion wpadmin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
"""

from django.conf import settings
from django.utils.importlib import import_module
from django.contrib import admin
from django.utils.translation import get_language_from_path
try:
from django.utils.module_loading import import_module
except ImportError:
from django.utils.importlib import import_module


def get_wpadmin_settings(admin_site_name='admin'):
Expand Down