              # urlparse chokes on lazy objects in Python 3
              login_url_as_str = force_str(login_url or settings.LOGIN_URL)
              # If the login url is the same scheme and net location then just
              # use the path as the "next" url.
              login_scheme, login_netloc = urlparse(login_url_as_str)[:2]
              current_scheme, current_netloc = urlparse(path)[:2]
              if ((not login_scheme or login_scheme == current_scheme) and
                  (not login_netloc or login_netloc == current_netloc)):
                  path = request.get_full_path()
              from django.contrib.auth.views import redirect_to_login
 
</s> remove             # urlparse chokes on lazy objects in Python 3
            login_url_as_str = force_str(login_url or settings.LOGIN_URL)
 </s> add             resolved_login_url = resolve_url(login_url or settings.LOGIN_URL) </s> remove             netloc = urlparse(redirect_to)[1]

 </s> add 
            login_scheme, login_netloc = urlparse(resolved_login_url)[:2]
              # urlparse chokes on lazy objects in Python 3
              login_url_as_str = force_str(login_url or settings.LOGIN_URL)
              # If the login url is the same scheme and net location then just
              # use the path as the "next" url.
            login_scheme, login_netloc = urlparse(resolved_login_url)[:2]
              current_scheme, current_netloc = urlparse(path)[:2]
              if ((not login_scheme or login_scheme == current_scheme) and
                  (not login_netloc or login_netloc == current_netloc)):
                  path = request.get_full_path()
              from django.contrib.auth.views import redirect_to_login
keep keep keep keep replace keep keep keep keep keep
 Fixed #15552 -- LOGIN_URL and LOGIN_REDIRECT_URL can take URLpattern names.

Thanks UloPe and Eric Florenzano for the patch, and Malcolm Tredinnick for
review. 
django/contrib/auth/decorators.py