What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-18 08:45:18
how to add decorators with class in django
from django.utils.decorators import method_decorator from django.contrib.auth.decorators import login_required #AS example class ProfileView(View): @method_decorator(login_required(login_url='login')) def get(self, request): ....... Add solution -
Python 2021-11-15 08:02:29
how to require login for Django function views
To require login for Django function-based views from django.contrib.auth.decorators import login_required @login_required def your_view(): ..... To require login for Django class-based views from django.contrib... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5