2010/11/6 Łukasz Rekucki <[email protected]>:
> On 5 November 2010 16:52, Valentin Golev <[email protected]> wrote:
>> I'm sorry, I misread it.
>> Please mention form.instance field in "forms for models" docs somewhere.
>>
>> The gain is inheritance. If one of your view classes is intented to be
>> subclassed and requires logging in, Mixins are natural solution, methinks
>
> You can see my clumsy implementation of a CBV decorator[1]. This lets you 
> write:
>
> @view_decorator(login_required)
> class ProtectedView(View):
>    pass
>
> class MyView(ProtectedView):
>    pass
>
> and the view function produced by MyView.as_view() will also have
> login_required applied to it. You can use a simillar technique to
> transform a function decorator to a Mixin, but class decorators are
> more readable IMHO.
>
> [1]: 
> https://github.com/lqc/django/blob/cbvdecoration_ticket14512/django/utils/decorators.py#L42
>
> PS. I guess I need to cleanup that patch so It could make it to 1.3 ;)

For the record - I'm still interested in getting CBV decorators into 1.3.

Yours,
Russ Magee %-)

-- 
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.

Reply via email to