Beispiel #1
0
def amend():
#
    r_id = request.args(0)
    ${obj_name}_instance = $obj_Name()
    ${obj_name}_instance.dbget(r_id)
    session.amend_id = r_id
    vdict = ${obj_name}_instance.toview()
Beispiel #2
0
def save():
# saves the record created or amended by the user
    ${obj_name}_instance = $obj_Name()
    ${obj_name}_instance.bindtotable(${obj_name}_instance.request.post_vars, True)
# validate and if correct save to database

    sid = ${obj_name}_instance.dbinsert()

    redirect(URL('show', args=sid))
    return
Beispiel #3
0
def update():
# first get the required record,
# then validate the new values
# finally if no errors, update with the amended values
    r_id = request.args(0)
    ${obj_name}_instance = $obj_Name()
    ${obj_name}_instance.dbget(r_id)
    ${obj_name}_instance.bindtotable(${obj_name}_instance.request.post_vars, True)
    sid = ${obj_name}_instance.dbupdate(r_id)
    redirect(URL('show', args=sid))
    return
Beispiel #4
0
def delete():
# deletes the given record - needed ?
    r_id = request.args(0)
    ${obj_name}_instance = $obj_Name()
    sid = ${obj_name}_instance.dbdelete(r_id)
    return sid
Beispiel #5
0
def index():
#  the default action - just show a list of $obj_Name s, if there are any
    ${obj_name}_instance = $obj_Name()
    ${obj_name}_list = ${obj_name}_instance.list_all('all', limitby=(0, 25))
    return dict(rows=${obj_name}_list)
Beispiel #6
0
def create():
# create a new record, returns an empty form but with defaults
#
    ${obj_name}_instance = $obj_Name()
    vdict = ${obj_name}_instance.toview()
Beispiel #7
0
def show():
# shows an individual record
    r_id = request.args(0)
    ${obj_name}_instance = $obj_Name()
    ${obj_name}_instance.dbget(r_id)
    vdict = ${obj_name}_instance.toview()
Beispiel #8
0
def select():
    ${obj_name}_instance = $obj_Name()
    ${obj_name}_list = ${obj_name}_instance.list_all('all', limitby=(0, 25))
    return dict(rows=${obj_name}_list)