# Path: tenant_schemas/utils.py
# def get_tenant_model():
#     return get_model(*settings.TENANT_MODEL.split("."))
# 
# def remove_www_and_dev(hostname):
#     """
#     Legacy function - just in case someone is still using the old name
#     """
#     return remove_www(hostname)
# 
# def get_public_schema_name():
#     return getattr(settings, 'PUBLIC_SCHEMA_NAME', 'public')


from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.db import connection
from django.http import Http404
from tenant_schemas.utils import get_tenant_model, remove_www_and_dev, get_public_schema_name
from django.db import utils


class TenantTutorialMiddleware(object):
    def process_request(self, request):
        connection.set_schema_to_public()
        hostname_without_port = remove_www_and_dev(request.get_host().split(':')[0])


# Path: tenant_schemas/utils.py
# def get_tenant_model():
#     return get_model(*settings.TENANT_MODEL.split("."))
# 
# def remove_www_and_dev(hostname):
#     """
#     Legacy function - just in case someone is still using the old name
#     """
#     return remove_www(hostname)
# 
# def get_public_schema_name():
#     return getattr(settings, 'PUBLIC_SCHEMA_NAME', 'public')


# Path: examples/tenant_tutorial/tenant_tutorial/middleware.py
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.db import connection
from django.http import Http404
from tenant_schemas.utils import get_tenant_model, remove_www_and_dev, get_public_schema_name
from django.db import utils



class TenantTutorialMiddleware(object):
    def process_request(self, request):
        connection.set_schema_to_public()
        hostname_without_port = remove_www_and_dev(request.get_host().split(':')[0])


        TenantModel = get_tenant_model()