Dimitris Kougioumtzis Blog About technology

Login protected CBV Django

Category Django

Posted on July 17, 2017



Login protected CBV Django


1
2
3
4
5
6
7
8
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required

class ProtectedViewMixin(object):

    @method_decorator(login_required)
    def dispatch(self, *args, **kwargs):
        return super(ProtectedViewMixin, self).dispatch(*args, **kwargs)

About

My name is Dimitris Kougioumtzis and i work as a Web developer at Rapidbounce Company

Elsewhere