Hey there,

Wanted to share an idea I had during some discussions in DjangoCon EU. When 
using CBV, sometimes we have to replicate behaviour between different 
handlers. For instance setting up certain objects, extra user checks... 
Normally the way to achieve this is to override the `dispatch()`, but it's 
a bit error-prone and doesn't feel too clean sometimes.

So I wrote a little piece of code that adds a `pre_handler()` method that 
gets called before the handler method, whatever that is. Here is the 
code: https://github.com/pablorecio/django/tree/pre-handler-view-method, if 
it's something that would get merged I'll happily submit a PR.

Thanks!
Pablo Recio


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/df0c7703-b496-4bfa-ad31-68b35be482fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to