You can use slug = IS_SLUG.urlify(text)
if for an other validator like IS_IN_SET(...) validator=IS_IN_SET(['a','b','c']) output_value,error=validator(input_value) error is None if input_value can be converted to output_value. On Nov 28, 10:05 am, Emceha <[email protected]> wrote: > Great - that works :) - I'm just beginning my journey with web2py :) > > So now another question - can I use validators (IS_SLUG for ex) > outside forms or database models? > > I have words (with Polish accents) that I want to convert to SLUG/URL > like strings (no accents). > Normally I would use Pythons unicodedata module but since I found out > about validators I'm just wondering if they're also accessible to > convert any string (would be useful in views) I like using them. > > Thanks for any ideas :) > > On Nov 28, 4:52 pm, mdipierro <[email protected]> wrote: > > > web2py needs to know how to display records of dzialy for the > > dropdown. Try this: > > > db.define_table('dzialy', > > Field("nazwa", required=True), > > Field("opis", "text", required=True), > > Field("kolejnosc", "integer", required=True), > > format='%(nazwa)s') > > > On Nov 28, 3:35 am, Emceha <[email protected]> wrote: > > > > Hi, > > > > I have such model in db.py > > > > db.define_table('dzialy', > > > Field("nazwa", required=True), > > > Field("opis", "text", required=True), > > > Field("kolejnosc", "integer", required=True)) > > > > db.define_table('artykuly', > > > Field('autor', db.auth_user, required=True), > > > Field('dzial', 'reference dzialy', required=True), > > > Field('tytul', 'string', required=True), > > > Field('tresc', 'text', required=True)) > > > > In default appadmin forms I get reference do auth_user just fine (i > > > get combo box as expected where I select user). But the same doesn't > > > happen to dzial field. It looks like string field and allows me to > > > enter anything I want but later on I get errors while I try to check > > > all artykuly fields. > > > > Is this a bug or am I doing something wrong? > > > > Thanks > >

