Actually, I've already added your function into my django_future.py ;-)
Thank you!
I wasn't sure it's good with inheritance - good to hear that!
But I wanted to know "the right way" in Django, and since your patch isn't
in trunk yet, I didn't want to rely on it.
If using both mixins and decorators simultaneously is how Django going to
work  - I'll put up with it.

--
Best Regards,
Valentin Golev
Lead Developer
r00, http://r00.ru

http://valyagolev.net
+7 921 789 0895, avaiable 12:00-18:00 MSK


2010/11/5 Ł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 ;)
>
> --
> Łukasz Rekucki
>
> --
> 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]<django-developers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>
>

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