django/django — pull request #502 by benoitbryon (2012-11-06 16:48:39+00:00)
Title: Class-based LoginView

Here is a proposal to replace django.contrib.auth.views.login by some class-based view.

The proposed implementation contains:

* a ``LoginView`` class, which focuses on providing a clean class based on FormView. As an example, it uses FormView's standard "success_url" instead of former "redirect_to" argument.

* a ``BackwardCompatibleLoginView`` class, which focuses on backward compatibility. As an example, if "redirect_to" is provided, it uses it instead of LoginView's "success_url".

* a ``login`` function, which makes it possible to use ``django.contrib.auth.views.login`` as before. It is a pre-configured BackwardCompatibleLoginView.

* a ``login_decorator`` decorator, which is just a shorcut to standard decorators for login views.