title: Django Middleware keeps redirecting, visiting admin-site not possible
body: <p>I followed a Django tutorial and wrote a Middleware class, to be precise its a "Login-Required"-Middleware so Users are just allowed to do some things on the website when they are logged in.</p>
  
  <p>The problem is that the middleware works as it should be but I can not visit the Django-Admin website anymore. Even after adding the admin-url to the exception list. He keeps redirecting me to the "normal login site".</p>
  
  <p>This is my middleware</p>
  
  <pre><code>import re
  
  from django.conf import settings
  from django.shortcuts import redirect
  from django.contrib.auth import logout
  from django.urls import reverse
  
  
  EXEMPT_URLS = [re.compile(settings.LOGIN_URL.lstrip('/'))]
  if hasattr(settings, 'LOGIN_EXEMPT_URLS'):
      EXEMPT_URLS += [re.compile(url) for url in settings.LOGIN_EXEMPT_URLS]
  
  class LoginRequiredMiddleware(object):
      def __init__(self, get_response):
          self.get_response = get_response
  
      def __call__(self, request):
          response = self.get_response(request)
          return response
  
      def process_view(self, request, view_func, view_args, view_kwargs):
          assert hasattr(request, 'user')
          path = request.path_info.lstrip('/')
          print (path)
  
          # if not request.user.is_authenticated():
          #     if not any(url.match(path) for url in EXEMPT_URLS):
          #         return redirect(settings.LOGIN_URL)
  
          url_is_exempt = any(url.match(path) for url in EXEMPT_URLS)
  
          if path == reverse('logout').lstrip('/'):
              logout(request)
  
          if request.user.is_authenticated() and url_is_exempt:
              return redirect(settings.LOGIN_REDIRECT_URL)
  
          elif request.user.is_authenticated() or url_is_exempt:
              return None
  
          else:
                  return redirect(settings.LOGIN_URL)
  </code></pre>
  
  <p>This is the Login_EXEMPT_URLS in settings.py</p>
  
  <pre><code>LOGIN_EXEMPT_URLS = (
  r'^admin/',
  r'^kalender/login/$',
  r'^kalender/logout/$',
  r'^kalender/reset-password/$',
  r'^kalender/reset-password/done/$',
  r'^kalender/reset-password/complete/$',
  r'^kalender/reset-password/$',
  r'^kalender/reset-password/confirm/',
  r'^kalender/returnjson/'
  )
  
  LOGIN_URL = '/kalender/login/'
  LOGIN_REDIRECT_URL = '/kalender/'
  LOGOUT_REDIRECT_URL = '/kalender/'
  ADMIN_REDIRECT_URL = '/admin/'
  </code></pre>
  
  <p>This is my urls.py</p>
  
  <pre><code>urlpatterns = [
      url(r'^$', views.home, name='home'),
      url(r'^login/$', login, {'template_name': 'kalender/login.html'}, name='login'),
      #url(r'^logout/$', logout, {'template_name': 'kalender/login.html'}, name='logout'),
      url(r'^logout/$', logout, name='logout'),
      url(r'^delete/$', views.delete, name='delete'),
      url(r'^delete2/$', views.delete2, name='delete2'),
      url(r'^addTimestamp/$', views.addTimestamp, name='addTimestamp'),
      url(r'^delete_many/$', views.delete_many, name='delete_many'),
      url(r'^add_many/$', views.add_many, name='add_many'),
      url(r'^addPT/$', views.addPT, name='addPT'),
      url(r'^deletePT/$', views.deletePT, name='deletePT'),
      url(r'^settings/$', views.edit_settings, name='edit_settings'),
      url(r'^nextMonth/$', views.nextMonth, name='nextMonth'),
      url(r'^previousMonth/$', views.previousMonth, name='previousMonth'),
      url(r'^view_profile/$', views.view_profile, name='view_profile'),
      url(r'^edit_profile/$', views.edit_profile, name='edit_profile'),
      url(r'^change_postbox/$', views.change_postbox, name='change_postbox'),
      url(r'^getNextTimestamp/$', views.getNextTimestamp, name='getNextTimestamp'),
      url(r'^returnjson/$', views.returnjson, name='returnjson'),
      url(r'^change-password$', views.change_password, name='change_password'),
      url(r'^reset-password/$', password_reset, {'template_name': 'kalender/reset_password.html'}, name='reset_password'),
      url(r'^reset-password/done/$', password_reset_done, {'template_name': 'kalender/reset_password_done.html'}, name='password_reset_done'),
      url(r'^reset-password/confirm/(?P&lt;uidb64&gt;[0-9A-Za-z]+)-(?P&lt;token&gt;.+)/$', password_reset_confirm, {'template_name': 'kalender/reset_password_formular.html'}, name='password_reset_confirm'),
      url(r'^reset-password/complete/$', password_reset_complete, {'template_name': 'kalender/reset_password_complete.html'}, name='password_reset_complete'),
      #url(r'sendEmail/^$', views.sendEmail, name='sendEmail'),
  ]
  </code></pre>
  
  <p>EDIT: Thanks to the help i got here, i now can login to the admin page, but as soon as i login, i get redirected to my home view via the LOGIN_REDIRECT_URL. But I want to keep proceeding to the admin page after login. How do i do that? You can see the redirects here: (the output of the console in Pycharm)</p>
  
  <pre><code>admin/
  [21/May/2018 13:11:38] "GET /admin/ HTTP/1.1" 302 0
  admin/login/
  [21/May/2018 13:11:38] "GET /admin/login/?next=/admin/ HTTP/1.1" 200 1668
  admin/login/
  [21/May/2018 13:11:44] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0
  admin/
  [21/May/2018 13:11:44] "GET /admin/ HTTP/1.1" 302 0
  kalender/
  </code></pre>