Fix urlconf include login_required handling

When a urlpattern matches but the view returns a 404, we shouldn't try to redirect to login. This is done by checking if the url resolves before and after the login_required pages are added. Only if it does not resolve before but does after should we redirect to login.