Is there a way to include a process inside factory but before the field
definitions start?
Example:
assign_to_party = SQLFORM.factory(
I WANT TO INCLUDE THIS LINE ABOVE THE LINE BELOW: limited_choices =
((db.Party.id > 0) & (~db.Party.id.belongs(all_current_assignees)))
Field('role_assignee', requires = IS_IN_DB(db, db.Party.id,
'%(party_name)s',zero=T('choose one')), comment = 'This will be the new
member of the party'))
The reason is that I have the factory form in a function that is mainly
used for other things and don't want to have this "limited_choices =" line
run every time the function is used. Right now I have to add the line
above where factory line starts. E.g.:
limited_choices = ((db.Party.id > 0) &
(~db.Party.id.belongs(all_current_assignees)))
assign_to_party = SQLFORM.factory(
Field('role_assignee', requires = IS_IN_DB(db, db.Party.id,
'%(party_name)s',zero=T('choose one')), comment = 'This will be the new
member of the party'))
My other choice: move factory to its own separate function but right now
within the same function UX looks smoother.
thanks,
Alex Glaros
--
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/d/optout.