ok, here is the snippets of code:
@auth.requires_login()
def worksheet0():
chkSession()
msg = ""
cidi = args_to_int(0) #case id
tCase = db.cases
tSheet = db.case_worksheets
sCase = db(tCase.id==cidi).select().first()
now = datetime.datetime.utcnow()
if not sCase or (now > (sCase.modified_date +
datetime.timedelta(days=7))): #prompt to update case information every 90
days
redirect(URL(f="case", args=[cidi]))
sidi = args_to_int(1) #sheet id
aidi = args_to_int(2) #action id
if sidi:
""" commented for now; tried to leave out the 3 text fields but it
didn't make a difference
uflds = []
flds = tSheet.fields
for f in flds:
if (f[:4] <> 'mtn_'):
uflds.append(f)
#return '%s' % uflds
"""
sform = SQLFORM(tSheet, record=sidi, buttons=[INPUT(_type='submit',
_name='submit', _value='Save Worksheet', _style="width:410px;"),
INPUT(_type='submit', _name='mtn_modify', _value='Save Worksheet and View
Motion to Modify', _style="width:410px;"), INPUT(_type='submit',
_name='summary', _value='Save Worksheet and View Analysis Summary',
_style="width:410px;")])
sform.vars.case_id = sCase.id
#tried to include the 3 fields in the form to ensure the data won't
get lost, but it still does
sform.vars.mtn_introduction = sform.vars.mtn_introduction
sform.vars.mtn_body = sform.vars.mtn_body
sform.vars.mtn_closing = sform.vars.mtn_closing
setstyles(sform, 700, "Save Worksheet")
if sform.process(onvalidation=chk_worksheet0).accepted:
if sform.vars.submit:
response.flash = "Worksheet Information Updated"
elif sform.vars.mtn_modify:
sidi = sform.vars.id #makes sure an appended record id gets
to the summary
session.flash = "Worksheet Information Saved & Updated"
redirect(URL(f="worksheet0a", args=[sCase.id,sidi]))
elif sform.vars.summary:
sidi = sform.vars.id #makes sure an appended record id gets
to the summary
session.flash = "Worksheet Information Saved & Updated"
redirect(URL(f="summary", args=[sCase.id,sidi]))
elif sform.errors:
response.flash = "Worksheet Errors"
try:
if sform:
pass
except:
sform = ""
slist = db(tSheet.case_id==cidi).select(orderby=~tSheet.input_date)
return dict(sCase=sCase, slist=slist, sform=sform, msg=msg)
def chk_worksheet0(f):
v = f.vars
v.sheet_name = v.sheet_name[:32]
v.sheet_notes = v.sheet_notes[:256]
#tried to make sure the three fields were included in the verification
just to ensure the data doesn't get lost, but it still does
v.mtn_introduction = v.mtn_introduction
v.mtn_body = v.mtn_body
v.mtn_closing = v.mtn_closing
return f
@auth.requires_login()
def worksheet0a():
chkSession()
cidi = args_to_int(0) #case id
sidi = args_to_int(1) #sheet id
if cidi and sidi:
tCase = db.cases
tSheet = db.case_worksheets
sCase = db(tCase.id==cidi).select().first()
sSheet = db(tSheet.id==sidi).select().first()
sform = SQLFORM(tSheet, record=sidi,
fields=['id','mtn_introduction','mtn_body','mtn_closing'], formstyle="divs")
setstyles(sform, 700, "Save Worksheet and Return to Main")
if sform.process().accepted:
session.flash = "Motion to Modify Updated"
redirect(URL(f="worksheet0", args=[sCase.id,sSheet.id]))
elif sform.errors:
response.flash = "Worksheet Errors"
return dict(sCase=sCase, sSheet=sSheet, sform=sform)
--
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.