  from django.core.exceptions import PermissionDenied
  from django.utils.decorators import available_attrs
  from django.utils.encoding import force_str
  
  
  def user_passes_test(test_func, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME):
      """
      Decorator for views that checks that the user passes the given test,
 
</s> remove     def testLoginRequired(self, view_url='/login_required/', login_url=settings.LOGIN_URL):
 </s> add     def testLoginRequired(self, view_url='/login_required/', login_url='/login/'): </s> remove from django.utils.encoding import force_str
 </s> add  </s> remove             login_scheme, login_netloc = urlparse(login_url_as_str)[:2]
 </s> add             login_scheme, login_netloc = urlparse(resolved_login_url)[:2] </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)
from django.shortcuts import resolve_url
  from django.core.exceptions import PermissionDenied
  from django.utils.decorators import available_attrs
  from django.utils.encoding import force_str
from django.shortcuts import resolve_url
  
  
  def user_passes_test(test_func, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME):
      """
      Decorator for views that checks that the user passes the given test,
keep keep add 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