yes:
def mywidget(field,value,options):
id='%s_%s' % (field._tablename,field.name)
else: raise SyntaxError, "widget cannot determine options"
opts+=[OPTION(v,_value=k) for k,v in options]
return SELECT(*opts,**dict(_id=id,_class=field.type,
_name=field.name,value=value,requires=field.requires))
db.table.field.widget=lambda f,v: mywidget(f,v,IS_IN_DB
(...).options())
On Jan 7, 4:07 am, Fran <[email protected]> wrote:
> On Jan 7, 10:02 am, annet <[email protected]> wrote:
>
> > when I comment out the last
> > validator, I have two drop boxes in the admin from which I can choose
> > a shape and a color and insert them into the database. However, when I
> > uncomment the two column unique constraint, the color drop box breaks,
> > it becomes a text field. When I insert a shape and color combination
> > that's already in the database I get an error, so the constraint
> > works, but loosing the drop box functionality on color is rather
> > awkward.
>
> Could you add the dropbox back via a widget?
>
> Although a framework-level solution would be better than this
> workaround hack...
>
> F
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---