Skip to content

Commit

Permalink
feat: remove code deprecated in Django 3
Browse files Browse the repository at this point in the history
  • Loading branch information
jerivas committed Sep 9, 2020
1 parent 82e7155 commit a4bd828
Show file tree
Hide file tree
Showing 18 changed files with 14 additions and 24 deletions.
3 changes: 0 additions & 3 deletions mezzanine/conf/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from warnings import warn

from django.utils.encoding import python_2_unicode_compatible


# Deprecated settings and their defaults.
DEPRECATED = {}


@python_2_unicode_compatible
class TemplateSettings(dict):
"""
Dict wrapper for template settings. This exists to enforce
Expand Down
3 changes: 2 additions & 1 deletion mezzanine/core/middleware.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import warnings

from functools import lru_cache

from django.contrib import admin
from django.contrib.auth import logout
from django.contrib.messages import error
Expand All @@ -15,7 +17,6 @@
from django.middleware.csrf import CsrfViewMiddleware, get_token
from django.template import Template, RequestContext
from django.utils.cache import get_max_age
from django.utils.lru_cache import lru_cache
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _

Expand Down
2 changes: 1 addition & 1 deletion mezzanine/core/templates/admin/base_site.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "admin/base.html" %}
{% load mezzanine_tags i18n staticfiles static %}
{% load mezzanine_tags i18n static static %}

{% block title %}{{ title }} | Mezzanine{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion mezzanine/core/templates/admin/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "admin/base_site.html" %}

{% load i18n mezzanine_tags staticfiles %}
{% load i18n mezzanine_tags static %}

{% block extrahead %}
{{ block.super }}
Expand Down
2 changes: 1 addition & 1 deletion mezzanine/core/templates/admin/login.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "admin/base_site.html" %}
{% load i18n staticfiles %}
{% load i18n static %}

{% block extrahead %}
<link rel="stylesheet" type="text/css" href="{% static settings.MEZZANINE_ADMIN_PREFIX|add:"css/login.css" %}">
Expand Down
2 changes: 1 addition & 1 deletion mezzanine/core/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!doctype html>
<html lang="{{ LANGUAGE_CODE }}"{% if LANGUAGE_BIDI %} dir="rtl"{% endif %}>
{% load pages_tags mezzanine_tags i18n staticfiles %}
{% load pages_tags mezzanine_tags i18n static %}

<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion mezzanine/core/templates/includes/editable_loader.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load i18n staticfiles %}
{% load i18n static %}

{% if has_site_permission %}
<link rel="stylesheet" href="{% static "mezzanine/css/editable.css" %}">
Expand Down
2 changes: 1 addition & 1 deletion mezzanine/core/templates/includes/editable_toolbar.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load i18n staticfiles %}
{% load i18n static %}

<div id="editable-toolbar" method="POST" action="{% url "admin:logout" %}">
{% url "admin:index" as admin_index_url %}
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/forms/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import settings
Expand Down Expand Up @@ -65,7 +64,6 @@ def visible(self):
return self.filter(visible=True)


@python_2_unicode_compatible
class AbstractBaseField(Orderable):
"""
A field for a user-built form.
Expand Down
2 changes: 1 addition & 1 deletion mezzanine/forms/templates/admin/forms/entries.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "admin/base_site.html" %}

{% load i18n staticfiles %}
{% load i18n static %}

{% block extrahead %}
{{ block.super }}
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/galleries/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

Expand Down Expand Up @@ -127,7 +126,6 @@ class Meta:
verbose_name_plural = _("Galleries")


@python_2_unicode_compatible
class GalleryImage(Orderable):

gallery = models.ForeignKey(
Expand Down
2 changes: 1 addition & 1 deletion mezzanine/galleries/templates/pages/gallery.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "pages/page.html" %}

{% load mezzanine_tags staticfiles %}
{% load mezzanine_tags static %}

{% block extra_css %}
<link rel="stylesheet" href="{% static "mezzanine/css/magnific-popup.css" %}">
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/generic/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from django.db import models
from django.template.defaultfilters import truncatewords_html
from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from django.utils.html import format_html

from django_comments.models import Comment
Expand Down Expand Up @@ -108,7 +107,6 @@ class Meta:
verbose_name_plural = _("Keywords")


@python_2_unicode_compatible
class AssignedKeyword(Orderable):
"""
A ``Keyword`` assigned to a model instance.
Expand Down
2 changes: 0 additions & 2 deletions mezzanine/pages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from django.urls import resolve, reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _, ugettext

from mezzanine.conf import settings
Expand All @@ -28,7 +27,6 @@ class Meta:
abstract = True


@python_2_unicode_compatible
class Page(BasePage, ContentTyped):
"""
A page in the page tree. This is the base class that custom content types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "admin/change_list.html" %}
{% load pages_tags staticfiles %}
{% load pages_tags static %}

{% block extrahead %}
{{ block.super }}
Expand Down
2 changes: 1 addition & 1 deletion mezzanine/pages/templates/pages/menus/admin.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load pages_tags i18n staticfiles %}
{% load pages_tags i18n static %}

<ol>
{% for page in page_branch %}
Expand Down
2 changes: 1 addition & 1 deletion mezzanine/utils/cache.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from functools import lru_cache
from hashlib import md5
from time import time

from django.core.cache import cache
from django.utils.lru_cache import lru_cache
from django.utils.cache import _i18n_cache_key_suffix

from mezzanine.conf import settings
Expand Down
2 changes: 1 addition & 1 deletion mezzanine/utils/static.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Utils for working with static files.
"""
from django.contrib.admin.templatetags.admin_static import static
from django.templatetags.static import static
from django.conf import settings
from django.utils.functional import lazy

Expand Down

0 comments on commit a4bd828

Please sign in to comment.