Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#10763 closed (duplicate)

Allow custom AuthenticationForm in django.contrib.auth login view.

Reported by: Felipe 'chronos' Prenholato Owned by: nobody
Component: contrib.auth Version: 1.1-beta
Severity: Keywords: login, forms, authentication, customization, custom
Cc: bas@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The idea is: allow develop to set a custom authentication form in login view without change much code.

Support of custom forms is usefull if developer use a custom form class, if plan to make more things in authentication that default form does (if for some motive he not want to write your own view) and, after all, form is better place to validate trought e-mail instead username (a common request I think).

This patch allow develop to send own authentication form to login view in urls.py and do what he wants in form.
I attach patch, a urls.py snippet and a form that I used to show example. My form use <a href="https://launchpad.net/django-form-utils">django-form-utils</a> in case to allow more customizable forms.

Attachments (3)

login_custom_form.diff (1.3 KB ) - added by Felipe 'chronos' Prenholato 16 years ago.
The patch in views.py
login_custom_form-urls.py (228 bytes ) - added by Felipe 'chronos' Prenholato 16 years ago.
The urls.py example.
login_custom_form-forms.py (1.7 KB ) - added by Felipe 'chronos' Prenholato 16 years ago.
The form in forms.py that I using, basically a copy of AuthenticationForm

Download all attachments as: .zip

Change History (6)

by Felipe 'chronos' Prenholato, 16 years ago

Attachment: login_custom_form.diff added

The patch in views.py

by Felipe 'chronos' Prenholato, 16 years ago

Attachment: login_custom_form-urls.py added

The urls.py example.

by Felipe 'chronos' Prenholato, 16 years ago

Attachment: login_custom_form-forms.py added

The form in forms.py that I using, basically a copy of AuthenticationForm

comment:1 by Alex Gaynor, 16 years ago

Resolution: duplicate
Status: newclosed

Dupe #8274.

comment:2 by Vasily Ivanov, 14 years ago

Cc: bas@… added

comment:3 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top