<reponame>yuniithings/yuniithings.com
from datetime import datetime
from django.shortcuts import redirect

def loginCheck(get_response):

    def middleware(request):

        response = get_response(request)

        if request.session.get('admin_idx', False):
            redirect('admin:loginView')

        return response

    return middleware
from datetime import datetime
from django.shortcuts import redirect

def loginCheck(get_response):

    def middleware(request):

        response = get_response(request)

        if request.session.get('admin_idx', False):
            redirect('admin:loginView')

        return response

    return middleware