Looks good. A few suggestions:
- There is no benefit to using a class with a single static method here
-- just extract the new() method and make it a standalone function (maybe
call it field_factory).
- If you rename kwargs in the new() function to something else (e.g.,
fargs), t
Thanks Joe,
I will have a better read... I had fix my issue, my customization of the
plugin introduce a couple of problem... I ends up refactoring the and only
load data when all the controlled field has to be updated "once". It fix
80% of the loading time issue the rest of the issue is user relat
Actually, I borrowed Anthony's excellent idea and made a "factory" class
for my field definitions.
First I defined a factory class:
class Field_Factory(object):
from gluon import Field
@staticmethod
def new(**kwargs):
default = dict(**kwargs)
def inner(name, **kwargs)
I found a pretty unclean workaround...
You have to set the widget like this :
db.tablename.REFERENCEDTABLEOFCHILDFIELD.widget = \
lazy_options_widget(on_key='no_table_PARENTFIELDNAME__selected',
off_key='PARENTFIELDNAME__unselected',
I wonder if we could we also make field lazy that way in context of custom
form...
I find some issue with some of my custom form where I use Field() to define
my field that will be use... This form is also dynamic, I manipulate field
visibility and lazy_option_widget() to make some field depend of
That's kinda clever. I may think of that!
-- Joe
On Thursday, March 23, 2017 at 4:19:05 PM UTC-7, Anthony wrote:
>
> Note, you might as well also add 'type': 'string' to your dictionary, and
> maybe 'length': 20. You can also give yourself some flexibility by creating
> a function:
>
> def ph
Note, you might as well also add 'type': 'string' to your dictionary, and
maybe 'length': 20. You can also give yourself some flexibility by creating
a function:
def phone_field(name, **kwargs):
defaults = {'type': 'string',
'length': 20,
'requires': IS_EMPTY_
7 matches
Mail list logo