Hello

I'm beginner... How to get DB Sqlalchemy table values to
webhelpers.html.tags select?

My controller account.py

    def register(self):
        return render('/account/register.html')

    @validate(schema=RegisterForm(), form="register")
    def create(self):
        response.charset = 'utf8'
        user = User()
        user.username = request.POST['login']
        user.password = request.POST['password']
->>   user.group = request.POST['group']
        try:
            user.save()
        except loginExistsException:
            flash('user already in db')
        else:
            flash('user added to db')
        return redirect_to(action='register')


Template:

${h.form('/account/create', method='post')}
<fieldset>
<legend>Reg form</legend>
<div><label for="loginField">Login: </label>
${h.text("login", id="loginField")}</div>
<div><label for="passwordField">Password: </label>
${h.password("password", id="passwordField")}</div>
<div><label for="password_confirmationField">Confirm password: </
label>
${h.password("password_confirmation", id="password_confirmationField")}
</div>

<! wrong
<div><label for="groupField">повторите пароль: </label>
${h.select()}</div>

</fieldset>
<div>${h.submit("create", "Register")}</div>
${h.end_form()}
</form>


So, h.select need to take

base.groups.name value's and send base.groups.id to db after reg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to