[web2py] Adding custom attributes to fields and tables

2018-04-22 Thread xelomac
I want to add a custom attribute so that I can decide which customwidget has to be used for a form field connected to that field. Example: db.define_table('person', Field('salutation', mycustomwidget='select2', label = T('Salutation'), requires=IS_IN_SET(GENDER), represent=lambda v, r:

[web2py] Re: SQLFORM.grid: represent a field with IS_IN_SET validator by its label instead of its value

2018-04-21 Thread xelomac
I've found a solution: rows = db(db[table].id == id).select() rendered_row = rows.render(0, fields=[db[table][column]]) value = rendered_row[column] On Saturday, April 21, 2018 at 12:31:49 PM UTC+2, xelomac wrote: > > Thank you Anthony. Works perfectly in a SQLFORM.grid. The valu

[web2py] Re: SQLFORM.grid: represent a field with IS_IN_SET validator by its label instead of its value

2018-04-21 Thread xelomac
t; Anthony > > On Sunday, April 15, 2018 at 4:47:27 AM UTC-4, xelomac wrote: >> >> Consider the following example. >> >> Model: >> >> GENDER = {"male": T("Mr.", lazy=False), >> "female": T("Ms.",

[web2py] SQLFORM.grid: represent a field with IS_IN_SET validator by its label instead of its value

2018-04-15 Thread xelomac
Consider the following example. Model: GENDER = {"male": T("Mr.", lazy=False), "female": T("Ms.", lazy=False)} db.define_table('person', Field('gender', label = T('Salutation'), requires=IS_IN_SET(GENDER)), Field('first_name', label = T('First Name'), Field('last_name',

[web2py] Re: Using variables in db.table.field expressions

2018-04-08 Thread xelomac
Sorry - I cannot comprehend what I have done wrong before. "if db[table][column].writable == False:" works now as expected. On Sunday, April 8, 2018 at 5:44:55 PM UTC+2, Anthony wrote: > > On Sunday, April 8, 2018 at 4:27:59 AM UTC-4, xelomac wrote: >> >> Hi all, >

[web2py] Using variables in db.table.field expressions

2018-04-08 Thread xelomac
Hi all, in a controller function I want to check if a field is set as writable in the model before updating it. "if db[table][column].writable == False" did not work. I have the following: def upd_field_value(): id,table,column = request.post_vars.id.split('.') value =

[web2py] Speaking URLs possible?

2013-09-02 Thread xelomac
Hi everybody, after playing around with routes.py for a while I wonder if what I want to do is possible at all. I want to rewrite the URLs shown to the visitor after clicking a menu link in the following way: Lets say I built a site that deals with colors. My menu shows base color links like

[web2py] Re: Speaking URLs possible?

2013-09-02 Thread xelomac
/show_color_page/title-of-the-page to access that page. Any idea why? On Monday, September 2, 2013 3:20:05 PM UTC+2, Anthony wrote: What does your routes.py file look like now? On Monday, September 2, 2013 2:22:38 AM UTC-7, xelomac wrote: Hi everybody, after playing around with routes.py

[web2py] Multilingual Content Management System with language switcher (Internationalization)

2013-08-27 Thread xelomac
Hi folks, I'm working on a multilingual CMS. Therefore I need to give the site visitor the option to change the content language using a language switcher menu link. My question is about changing content language not about changing surface language (please no T function answers here :-) So

[web2py] Re: Multilingual Content Management System with language switcher (Internationalization)

2013-08-27 Thread xelomac
/layout.html#L62 https://github.com/web2py/web2py/blob/master/applications/admin/models/0.py#L79 On Tuesday, 27 August 2013 06:00:57 UTC-5, xelomac wrote: Hi folks, I'm working on a multilingual CMS. Therefore I need to give the site visitor the option to change the content language

Re: [web2py] Re: Multilingual Content Management System with language switcher (Internationalization)

2013-08-27 Thread xelomac
in the book [1]. [1] http://web2py.com/books/default/chapter/29/04/the-core#URL-rewrite On Tue, Aug 27, 2013 at 1:08 PM, xelomac kai...@kaisermacht.dejavascript: wrote: Thanks - good idea - but how do I force the URL to show the language token like domain.com/mayapp/en/mycontroller

[web2py] Re: Web2Py on OpenShift

2013-08-19 Thread xelomac
] master - master (pre-receive hook declined) error: failed to push some refs to 'ssh://rhcloud.com/~/git/web2py.git/' Any idea what's going wrong? Best, xelomac On Friday, June 8, 2012 5:07:39 PM UTC+2, Andrew Replogle wrote: Just FYI to anyone interested, I've put together a web2py