django-cprofile-middleware
django-cprofile-middleware copied to clipboard
Add a settings to by the can method.
I think it can be interesting to add a settings to bypass the can method. I think on the development mode it's not necessary to be staff to show the result of profiling. Maybe it can be interesting to add a settings to bypass the current condition.
Yeah, I agree with you. I've heard that feedback from a few people now.
At least two possible solutions:
- Add a setting that's to the weight of:
CPROFILE_MIDDLEWARE_REQUIRE_STAFF
where the default value isTrue
- Allow users to pass a callable that takes the
User
object and returns whether or not they're allowed to see the middleware output.
I think I prefer (1) in this case. What do you think?
I agree with you I prefer the first solution. It's more simple and is sufficient. I'm going to make the contribution soon as possible. Today or tomorrow.