The wizard convention is the following:

- table and field names are lower case
- table names have a t_ prefix
- field names have a f_ prefix
- reference fields have the same name as the table being referenced
(but with f_, not t_)

you can then use shortcuts:

Person = db.define_table('t_person',Field('f_name'))

It can be ugly but causes no ambiguities and it is easy to read.
You can also compute labels from fields names automatically

label = ' '.join(x.capitalize() for x in field_name[2:].split('_'))



On Feb 1, 10:12 pm, Martin Barnard <barnard.mar...@gmail.com> wrote:
> I'd be cautious about some of those field names. I'm not about to look them
> up, but they look suspiciously like they may collide with reserved words.
> I'm looking particularly hard at 'type' and 'text'. You may want to check
> that.
>
> Martin.
>
> I don't mind typing the extra characters now that work bought me one of
> these <http://www.kinesis-ergo.com/advantage_pro.htm> :)
>
> On 1 February 2011 23:08, howesc <how...@umich.edu> wrote:
>
>
>
>
>
>
>
> > i try to use pythonic naming conventions in my database.
>
> > i prefer:
> > db.define_table('address_type',
> > Field('name'))
>
> > db.define_table('contact',
> > Field('name'))
>
> > db.define_table('address',
> > Field('contact', db.contact),
> > Field('type', db.address_type),
> > Field('text'))
>
> > but perhaps mainly because i don't like to type all those extra characters.
> > :)

Reply via email to