I have a student registration form that immediately after registering a
student I want to use those details in another form, a payments form to
enter that student's payment status but my code keeps returning none like
student is not available, I am doing something wrong here please assist me
figure it out or show me a better way of doing achieving the same logic:
*CODE:*
*def registration():*
* form=SQLFORM(db.store_registration) if form.process().accepted:
response.flash=T('Details Registered') student_name =
"{form.vars.first_name} {form.vars.last_name}" # Redirect to
payments view with student's name as parameter
redirect(URL('default', 'payments', vars={'student_name': student_name}))
return locals()def payments(): student_name =
request.vars.student_name # Loading student's information from the
database student = db(db.store_registration.first_name + ' ' +
db.store_registration.last_name == student_name).select().first() if
student is None: raise HTTP(404, "Student not found")*
* form.vars.student = student.id # Set the student reference in the
payment form*
* form = SQLFORM(db.payments) if form.process().accepted:
response.flash = T('Payment details submitted') return locals()*
Regards
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/3ef0d52f-001d-456a-888b-496f00990e9en%40googlegroups.com.