I opened up a ticket http://code.djangoproject.com/ticket/15215 in
order to make the class based view permission checking easier.
I don't know do other think that they need to be easier to check, but
I think following API would be simple:
class ProtectedView(TemplateView, ForbiddenMixin):
template_name = 'secret.html'
forbidden_checks = (login_required,
has_perms('auth.change_user'),)
forbidden_checks is list of functions (request, *args, **kwargs) ->
bool, has_perms is thus function that returns function.
This API would also allow to *override* the checks in subclassed
views, even make them empty again if needed.
I have not yet tried to create ForbiddenMixin but I don't think it
should be too difficult.
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.