Additionally, it's always possible to apply decorators to CBV's like this:
class MyView(...):
...
my_view = some_decorator(MyView.as_view())
Then use my_view in your urls.py. This works because as_view() returns the
"real view" function.
...and you can use method_decorator like this:
@meth
Hi,For class based views there are mixins, LoginRequiredMixin,
PermissionRequiredMixin which give the same
functionality.https://docs.djangoproject.com/en/4.0/topics/auth/default/#the-loginrequired-mixinhttps://docs.djangoproject.com/en/4.0/topics/auth/default/#the-permissionrequiredmixin-mixinWh
Hi,
as of today, adding a permission_required and / or a login_required
decorator on a class based view is a bit ugly, as you have to decorate the
dispatch method, which you then have to write down in your class.
On top of that, you can't directly use the decorator itself, as you have to
wrap i
Hi!
I think you've found the wrong mailing list for this post. This mailing
list is for discussing the development of Django itself, not for support
using Django. This means the discussions of bugs and features in Django
itself, rather than in your code using it. People on this list are unlikely
t