title: Transform Function in Class Based View with decorator in Django
body: <p>I have this code:</p>
  
  <pre><code>#decorators.py
  from django.contrib.auth.decorators import user_passes_test
  
  
  def superuser_required(func):
      return user_passes_test(
          lambda u: u.is_authenticated() and u.is_superuser)(func)
  
  
  
  # views.py
  @superuser_required
  def dashboard_candidates(request):
      persons = Person.objects.all()
      return render(request, 'my_template.html', {'persons': persons})
  </code></pre>
  
  <p>How to transform this function in ListView adapting the decorator?</p>
  
  <p>I try:</p>
  
  <pre><code>PersonList(LoginRequiredMixin, ListView)
      model = Person
      paginate_by = 10
  </code></pre>
  
  <p>I do not know how to implement the decorator mentioned above.</p>