Configurable forms, issue:49

This commit is contained in:
Eskil Heyn Olsen
2013-01-03 22:00:29 -08:00
parent b15736accd
commit f83092865b
3 changed files with 91 additions and 12 deletions
+32 -1
View File
@@ -59,6 +59,37 @@ The following is a list of all the available context processor decorators:
* ``send_login_context_processor``: Send login view
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)
from flask_security.forms import RegisterForm
class ExtendedRegisterForm(RegisterForm):
first_name = TextField('First Name', [Required()])
last_name = TextField('Last Name', [Required()])
@security.register_form
def security_register_form():
return ExtendedRegisterForm
The following is a list of all the available form override decorators:
* ``login_form``: Login form
* ``confirm_register_form``: Confirmable register form
* ``register_form``: Register form
* ``forgot_password_form``: Forgot password form
* ``reset_password_form``: Reset password form
* ``send_confirmation_form``: Send confirmation form
* ``passwordless_login_form``: Passwordless login form
Emails
------
@@ -93,4 +124,4 @@ templates you can specify an email context processor with the
# This processor is added to all emails
@security.email_context_processor
def security_mail_processor():
return dict(hello="world")
return dict(hello="world")