brack3t/django-braces — pull request #8 by mjtamlyn (2012-09-09 10:18:37+00:00)
Title: Add PrepareMixin

I've added here a mixin we use intermittently when the normal flow of a class-based view becomes awkward. It allows you to place permission and/or existence checking earlier in the process in a more reusable way, especially useful when dealing with permissions of related objects. It also allows you to do more than just 404 if permissions are different which is hard to do from within a normal integration point (e.g. get_object). Hopefully my documentation makes sense!

Personally I find this updated dispatch method a much cleaner way to do checking early in a view compared to messing around in the dispatch method, mainly as `args, kwargs, request` are all set already. Perhaps some of the other mixins here could be made cleaner using this, I've not looked too closely.

I'm open to changes of terminology if you think the naming is unclear.