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.
Introduced class-based LoginView in django.contrib.auth.
Simplified class-based LoginView, moved backward compatibility suppor…
…t to BackwardCompatibleLoginView. The latter is the one used in django.contrib.auth.views.login().
Merge branch 'login-cbv' into login-cbv-merge
Created ticket https://code.djangoproject.com/ticket/19256 about class-based login view.
Looking at related https://code.djangoproject.com/ticket/17209, I see https://github.com/mjtamlyn/django/compare/auth-cbv... I guess I can rebase this pull request on @mjtamlyn's work.
Yeah there's a CBV version of LoginView in there which pretty much works. There were some particular issues with the original implementation that at least @andrewgodwin didn't like which are commented on that issue. It's definitely too late for this to get in 1.5 but I'd love to see it in 1.6. I kind of ran out of steam with getting it polished.
It needs a decent accepted spec of how we're going to implement the new CBVs and a core dev on side to get it going. I think this is ideal sprint material (DjangoConEU 2013 if not before?). I'm also going to cc @bmispelon in here as he wrote the original versions (all I've done is attempt to bring them up to speed).
Closing this pull-request: duplicate of https://github.com/mjtamlyn/django/compare/auth-cbv