mirror of
https://github.com/wassname/flask-security.git
synced 2026-07-02 17:00:14 +08:00
Merge pull request #66 from eskil/registerform
Update documentation reg. configurable forms
This commit is contained in:
+6
-10
@@ -62,12 +62,9 @@ The following is a list of all the available context processor decorators:
|
||||
Forms
|
||||
-----
|
||||
|
||||
All forms can be overridden in much the same way as context
|
||||
processors. For each form used, you can specify a function that
|
||||
returns the form class. This allows you to override/extend forms. For
|
||||
example, to add extra fields to the register form::
|
||||
|
||||
security = Security(app, user_datastore)
|
||||
All forms can be overridden. For each form used, you can specify a
|
||||
replacement class. This allows you to add extra fields to the
|
||||
register form or override validators::
|
||||
|
||||
from flask_security.forms import RegisterForm
|
||||
|
||||
@@ -75,11 +72,10 @@ example, to add extra fields to the register form::
|
||||
first_name = TextField('First Name', [Required()])
|
||||
last_name = TextField('Last Name', [Required()])
|
||||
|
||||
@security.register_form
|
||||
def security_register_form():
|
||||
return ExtendedRegisterForm
|
||||
security = Security(app, user_datastore,
|
||||
register_form=ExtendedRegisterForm)
|
||||
|
||||
The following is a list of all the available form override decorators:
|
||||
The following is a list of all the available form overrides:
|
||||
|
||||
* ``login_form``: Login form
|
||||
* ``confirm_register_form``: Confirmable register form
|
||||
|
||||
Reference in New Issue
Block a user