I think it should be this:

db.policy_documents.policy_id.requires =
IS_IN_DB(db,db.policies_and_strategies.id,   '%
(name_of_policy_strategy)s')

On Mar 27, 9:48 am, Johann Spies <[email protected]> wrote:
> The ticket:
> Traceback (most recent call last):
>   File "/home/js/web2py/gluon/restricted.py", line 173, in restricted
>     exec ccode in environment
>   File "/home/js/web2py/applications/sadec/controllers/appadmin.py",
> line 418, in <module>
>   File "/home/js/web2py/gluon/globals.py", line 96, in <lambda>
>     self._caller = lambda f: f()
>   File "/home/js/web2py/applications/sadec/controllers/appadmin.py",
> line 125, in insert
>     if form.accepts(request.vars, session):
>   File "/home/js/web2py/gluon/sqlhtml.py", line 946, in accepts
>     fields[fieldname] = int(fields[fieldname])
> ValueError: invalid literal for int() with base 10: 'National Policy
> on Vocational Education and Training'
>
> The model:
>
> db.define_table("policy_documents",
>                 Field("name"),
>                 Field("file", "upload"),
>                 Field("policy_id", db.policies_and_strategies))
>
> db.policy_documents.policy_id.requires = IS_IN_DB(
>     db,db.policies_and_strategies.name_of_policy_strategy,
>     '%(name_of_policy_strategy)s')
>
> I get a drop-down list (in appadmin) from which I choose but the value
> inserted in db.policy_documents.policy_id is not an integer!  Why not?
>
> Regards
> Johann
>
> --
>        "Every good gift and every perfect gift is from above,
>       and cometh down from the Father of lights, with whom
>       is no variableness, neither shadow of turning."
>                              James 1:17

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to