On 3 June 2013 18:09, <[email protected]> wrote: > # `DecoratorMixin` > > `DecoratorMixin` is a class factory that converts any view decorator into > a class-based view mixin. > > Using it is easy and intuitive: > > LoginRequiredMixin = DecoratorMixin(login_required) >
Now this, this feels pythonic. Bravo! I'm so doing this in future projects... (Though, class factories are spelled lowercase_with_underscores, no? At least in Django. For instance formset_factory().) I've had a look at various LoginRequiredMixins out there (everybody makes their own it seems, including me). It is quite common that it doesn't cover all the things that login_required covers (like supporting the new way of doing users in 1.5) so in the case of LoginRequiredMixin, I think the safest solution is to include a mixin in core anyway. HM -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
