Skip to content

Commit 17de1d0

Browse files
committed
Various compatibility fixes
1 parent 54a4a2e commit 17de1d0

File tree

8 files changed

+13
-8
lines changed

8 files changed

+13
-8
lines changed

feincms/admin/tree_editor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from django.contrib.admin.views import main
1212
from django.contrib.admin.actions import delete_selected
1313
from django.contrib.auth import get_permission_codename
14-
from django.contrib.staticfiles.templatetags.staticfiles import static
1514
from django.db.models import Q
1615
from django.http import (
1716
HttpResponse,
@@ -31,6 +30,12 @@
3130
from feincms import settings
3231
from feincms.extensions import ExtensionModelAdmin
3332

33+
try:
34+
# Django<3
35+
from django.contrib.staticfiles.templatetags.staticfiles import static
36+
except ImportError:
37+
from django.templatetags.static import static
38+
3439

3540
logger = logging.getLogger(__name__)
3641

feincms/contrib/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def to_python(self, value):
6969
assert value is None
7070
return {}
7171

72-
def from_db_value(self, value, expression, connection, context):
72+
def from_db_value(self, value, expression, connection, context=None):
7373
return self.to_python(value)
7474

7575
def get_prep_value(self, value):

feincms/module/medialibrary/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def register_filetypes(cls, *types):
143143
cls.filetypes[0:0] = types
144144
choices = [t[0:2] for t in cls.filetypes]
145145
cls.filetypes_dict = dict(choices)
146-
cls._meta.get_field("type").choices[:] = choices
146+
cls._meta.get_field("type").choices = choices
147147

148148
def __init__(self, *args, **kwargs):
149149
super(MediaFileBase, self).__init__(*args, **kwargs)

feincms/templates/admin/feincms/_regions_js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% load staticfiles %}
1+
{% load static %}
22
<script type="text/javascript" charset="utf-8">
33
IMG_DELETELINK_PATH = "{% static 'feincms/img/icon_deletelink.gif' %}";
44

feincms/templates/admin/feincms/item_editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% extends "admin/change_form.html" %}
2-
{% load i18n admin_modify admin_urls staticfiles %}
2+
{% load i18n admin_modify admin_urls static %}
33

44
{% block extrahead %}{{ block.super }}
55
{% block feincms_jquery_ui %}

feincms/templates/admin/feincms/load-jquery.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% load staticfiles %}
1+
{% load static %}
22
{% comment %}
33
Include jquery, override this template if you want to use a cdn version
44
or load more plugins or whatnot

feincms/templates/admin/feincms/tree_editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% extends "admin/change_list.html" %}
2-
{% load admin_list i18n staticfiles %}
2+
{% load admin_list i18n static %}
33

44
{% block extrahead %}
55
{{ block.super }}

tests/testapp/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
# Anything to make mptt.templatetags.mptt_admin importable
7979
deprecation.RemovedInDjango20Warning = deprecation.RemovedInDjango21Warning
8080

81-
elif django.VERSION >= (2,):
81+
elif django.VERSION < (3,):
8282
from django.utils import deprecation
8383

8484
# Anything to make mptt.templatetags.mptt_admin importable

0 commit comments

Comments
 (0)