From e22aff51a4d4192857ebf0fac7463be4441ad0cd Mon Sep 17 00:00:00 2001 From: Eskil Heyn Olsen Date: Thu, 10 Jan 2013 07:57:44 -0800 Subject: [PATCH 1/2] Clarify user model/register form interaction in docs. --- docs/customizing.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/customizing.rst b/docs/customizing.rst index 8bc5601..d2c6018 100644 --- a/docs/customizing.rst +++ b/docs/customizing.rst @@ -75,6 +75,18 @@ register form or override validators:: security = Security(app, user_datastore, register_form=ExtendedRegisterForm) +For the ``register_form`` and ``confirm_register_form``, each field is +passed to the user model when a user is created. In the above case, +the ``first_name`` and ``last_name`` fields are passed directly to the +model, so the model should look like:: + + class User(db.Model, UserMixin): + id = db.Column(db.Integer, primary_key=True) + email = db.Column(db.String(255), unique=True) + password = db.Column(db.String(255)) + first_name = db.Column(db.String(255)) + last_name = db.Column(db.String(255)) + The following is a list of all the available form overrides: * ``login_form``: Login form From 4dd944a8c11c1a6dcfc00483eaa29202c66d0dff Mon Sep 17 00:00:00 2001 From: Eskil Heyn Olsen Date: Fri, 11 Jan 2013 18:38:05 -0800 Subject: [PATCH 2/2] Another fix to docs --- docs/customizing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/customizing.rst b/docs/customizing.rst index d2c6018..e4e4836 100644 --- a/docs/customizing.rst +++ b/docs/customizing.rst @@ -76,9 +76,9 @@ register form or override validators:: register_form=ExtendedRegisterForm) For the ``register_form`` and ``confirm_register_form``, each field is -passed to the user model when a user is created. In the above case, -the ``first_name`` and ``last_name`` fields are passed directly to the -model, so the model should look like:: +passed to the user model (as kwargs) when a user is created. In the +above case, the ``first_name`` and ``last_name`` fields are passed +directly to the model, so the model should look like:: class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True)