def add_student_to_session():
    form = SQLFORM.factory(Field('admission_number', requires=IS_NOT_EMPTY
())).process()
    if form.accepted:
        student = None
        student_details = None
        admission_number = form.vars.admission_number
        row = db.student(db.student.admission_number==admission_number)
        if not row:
            session.flash ='Admission number does not exist. Please check 
and retry.'
            redirect(URL(r=request, f='add_student_to_session'))
        else:
            db.school_session.admission_number.writable = False
            db.school_session.admission_number.default = admission_number
            form = crud.create(db.school_session)
            student = db.student(row.id)
            student_details = SQLFORM(db.student, student, readonly=True)



On Saturday, 2 November 2013 21:44:30 UTC-5, Rupesh Pradhan wrote:
>
> Please give a suggestion too.
>

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to