Ticket #22006: ticket-22006.2.diff

File ticket-22006.2.diff, 856 bytes (added by mockforest, 10 years ago)

lines cut to max length of 80

  • docs/topics/auth/default.txt

    diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt
    index 5d93e43..c1385c1 100644
    a b To apply a permission to a :doc:`class-based generic view  
    572572<django.views.generic.base.View.dispatch>` method on the class. See
    573573:ref:`decorating-class-based-views` for details.
    574574
     575If you have many generic views that should be decorated with
     576:func:`~django.contrib.auth.decorators.login_required`, an alternative is to
     577implement a mixin, like this::
     578
     579    class LoginRequiredMixin(object):
     580        @classmethod
     581        def as_view(cls):
     582            return login_required(super(LoginRequiredMixin, cls).as_view())
     583
     584    class MyView(LoginRequiredMixin, ...):
     585        # this is a generic view
     586        ...
    575587
    576588.. _built-in-auth-views:
    577589
Back to Top