In the book there's this comments about it:
[cite]
Most attributes of fields and tables can be modified after they are defined:
db.define_table('person',Field('name',default=''),format='%(name)s')
db.person._format = '%(name)s/%(id)s'
db.person.name.default = 'anonymous'
(notice that attributes of tables are usually prefixed by an
underscore to avoid conflict with possible field names).
[/cite]
But this is not working as expected.
--
Vinicius Assef.
On Sun, Oct 30, 2011 at 3:32 AM, Vinicius Assef <[email protected]> wrote:
> Hi guys.
>
> I'm using wwwsqldesigner to visually generate my models and I faced a problem.
>
> My tables are defined like this:
> db.define_table('my_table', Field('name'))
>
> I'd like to do this (or something like that), after all
> define_table()'s automatically generated by wwwsqldesigner:
> db.my_table.format = '%(name)s'
>
> I saw it is impossible because "_format" is stored as a tuple
> initialized with None if it's not passed to define_table().
>
> Like things work now, I have to modify models generated by
> wwwsqldesigner and it's not DRY.
>
> Is there a way to accomplish my need?
>
> --
> Vinicius Assef.
>