Support Django 2.0

This is the final change required for Django 2.0 support. Instead of using
MIDDLEWARE_CLASSES use MIDDLEWARE setting. Support for new style middleware was
provided in version 0.3.0, so depend on that version. Django built-in middleware
already supports new style and plinth middleware will now support new style.

The actual semantics of the middleware don't need changes. See:
https://docs.djangoproject.com/en/2.0/topics/http/middleware/#upgrading-pre-django-1-10-style-middleware

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2018-03-12 17:27:26 -04:00
1 parent 474b363f0b
commit 1da594c32d
5 files changed
+12 -9

No files matched your search

+5 -3
View File
@@ -20,17 +20,19 @@ Django middleware to redirect to firstboot wizard if it has not be run
yet.
"""
import logging
from django.conf import settings
from django.http.response import HttpResponseRedirect
from django.urls import reverse
from django.conf import settings
import logging
from django.utils.deprecation import MiddlewareMixin
from plinth.modules import first_boot
LOGGER = logging.getLogger(__name__)
class FirstBootMiddleware(object):
class FirstBootMiddleware(MiddlewareMixin):
"""Forward to firstboot page if firstboot isn't finished yet."""
@staticmethod