ability to mark entire directory (and subdirs) as login_required/is_staff
|Reported by:||Simon G. <dev@…>||Owned by:||nobody|
|Cc:||dev@…||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
It would be very nice to have the ability to mark an entire directory (URL Path) as login_required/etc. For example, everything below /admin/ should be checked with is_staff.
There are a number of reasons for this:
1) it's tidier and more DRY-ish to not have decorators on every single view.
2) it's safer - by decorating a directory rather than every view, you're less likely to forget one.
3) it's a common system - generally everything under /admin/ needs a staff member, everything in /user/ needs a logged in user, etc.
I'm not sure how this could be done - possibly by adding a parameter to a URL conf (although I don't know if that's the "right" place), or by setting a flag in a views file.
Change History (7)
comment:1 Changed 8 years ago by Simon G. <dev@…>
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Design decision needed