Re: adding permission_required decorator for class based view

2022-02-09 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
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:

adding permission_required decorator for class based view

2022-02-09 Thread Albert
Hi,For class based views there are mixins, LoginRequiredMixin, PermissionRequiredMixin which give the same

adding permission_required decorator for class based view

2022-02-09 Thread Martin Milon
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

Re: TypeError: __init__() got an unexpected keyword argument 'name'

2022-02-09 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
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