﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25235	Document alternate syntax for class-based view decoration	zauddelig	nobody	"The class based views decoration documentation is in my opinion ugly and I think is keeping some beginners from class based views.

Based on that ,one has three methods:

1. Use Multi Inheritance, which is both risky and dreadful, imho is too easy to have side effects, still is the more clean solution described.

2. Use method_decorator, which is better if not that you have to wrap every decorator function inside of it and are forced rewrite `dispatch`.

3. wrapping directly the `Klass.as_view()`, better but as documented it seem more a problem than anything.  

The advantage of the third method is that you preserve the logic of the Classes, so that the same View can change, more or less slightly, it's logic in different contexts.

I usually use solutions like this:

{{{
 view = reduce(
    lambda x, f: f(x),
    (
        third_decorator,
        second_decorator,
        first_decorator,
    ),
    ViewKlass.as_view()
)
}}}

The good thing is that you can wrap group of common decorators in a single iterable.

I don't know if it would be better to have a `django.utils` to do this or just add to documentation this or some similar method."	Cleanup/optimization	closed	Utilities	1.8	Normal	wontfix	documentation, class based views, utilities, decorators		Unreviewed	0	0	0	0	1	0
