Hello all,

I'm writing a web app where people can log their exercise sessions. 
Basically, sessions are timed, and the faster the better. To this end, I 
store seconds in my model:

    Field('f_record_taken', type='date',notnull=True,default=datetime.date.
today(),
          label=T('Record Taken')),
    Field('f_user', type='reference auth_user',notnull=True,
          label=T('User')),
    Field('f_exercise', type='reference t_exercise_description',notnull=True
,
          label=T('Exercise')),
    ### either repetitions, time or weight
    Field('f_measure', type='double',notnull=True,
          label=T('Measurement')),
    Field('f_comment', type='string',label=T("Comment")),



I use SQLForm to let users insert new entries:

form = SQLFORM(db.t_exercise_log, fields =  ["f_record_taken", "f_measure", 
"f_comment"]

Obviously, this will render the f_measure field as a single form entry - 
but users do not want to enter seconds because it requires them to do the 
math from minutes to seconds. I could theoretically use a time field 
instead, but I use the f_measure field for other types of exercise as well 
(think "weight lifted in kilos").

How would you go about doing this? I assume I could use SQLForm.Factory, 
but then I might have to validate the form by hand (?). So I'm wondering 
what would be the best, most web2py-ish solution here, e.g. by modifying 
some kind of representation logic in the model.


Kind regards,

Michael

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to