Skip to content

Commit

Permalink
Restored backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardopires committed Sep 21, 2016
1 parent 90f8b14 commit 65bf9da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tenant_schemas/management/commands/migrate_schemas.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import django

from django.conf import settings
from django.core.management.commands.migrate import Command as MigrateCommand
from django.db import connection
import django


from tenant_schemas.management.commands import SyncCommon
Expand All @@ -15,7 +16,7 @@ def __init__(self, stdout=None, stderr=None, no_color=False):
"""
Changes the option_list to use the options from the wrapped migrate command.
"""
if django.VERSION <= (1,10,0):
if django.VERSION <= (1, 10, 0):
self.option_list += MigrateCommand.option_list
super(Command, self).__init__(stdout, stderr, no_color)

Expand Down
9 changes: 7 additions & 2 deletions tenant_schemas/middleware.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import django

from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import DisallowedHost
from django.db import connection
from django.http import Http404
from tenant_schemas.utils import (get_tenant_model, remove_www,
get_public_schema_name)
from django.utils.deprecation import MiddlewareMixin
if django.VERSION >= (1, 10, 0):
MIDDLEWARE_MIXIN = django.utils.deprecation.MiddlewareMixin
else:
MIDDLEWARE_MIXIN = object


class TenantMiddleware(MiddlewareMixin):
class TenantMiddleware(MIDDLEWARE_MIXIN):
"""
This middleware should be placed at the very top of the middleware stack.
Selects the proper database schema using the request host. Can fail in
Expand Down

0 comments on commit 65bf9da

Please sign in to comment.