code: def permission_required_with_ajax(perm, login_url=None):
      
      return user_passes_test_with_ajax(lambda u: u.has_perm(perm), login_url=login_url)
docs: Decorator for views that checks whether a user has a particular
      permission enabled, redirecting to the log-in page if necessary,
      but returns a special response for ajax requests.  See
      :meth:`eulcore.django.auth.decorators.user_passes_test_with_ajax`.
  
      Usage is the same as
      :meth:`django.contrib.auth.decorators.permission_required` ::
  
          @permission_required_with_ajax('polls.can_vote', login_url='/loginpage/')
          def my_view(request):
              ...