#2200 closed enhancement (wontfix)
Generic Views should have user_passes_test=func argument
Reported by: | Owned by: | Jacob | |
---|---|---|---|
Component: | Generic views | Version: | dev |
Severity: | normal | Keywords: | login_required user_passes_test generic view |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
django.views.generic.create_update.*_object Generic Views allow for the argument 'login_required=True' which behaves just like the auth decorator of the same name.
Many times just being logged in is not enough, but certain permissions are required for a view (reporter vs. editor vs. reviewer etc.)
Currently you need to write a custom generic view to get the auth user_passes_test decorator functionality.
It would greatly simplify things if the generic views accepted a 'user_passes_test=func' argument.
Change History (2)
comment:1 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 18 years ago
I understand that it can be wrapped easilly, you can also do:
@login_required def my_view(request, *args, **kwargs): return create_update(request, *args, **kwargs)
But there is a login_required shortcut directly on the generic views. Just thought it would be a good addition.
You can wrap the generic view like so: