On Jan 1, 6:34 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > On Jan 1, 9:48 am, pihentagy <pihent...@gmail.com> wrote:
> > I cannot understand why you should write: > > Field('customer', db.partner, requires=IS_IN_DB(db, > > 'partner.id','partner.id')) > > > and not just simply > > Field('customer') > The sytnax is Field(name, type). The default type is a string. If you > want it to be a reference it has to said explicitly. You do the same > in Django. The validator is optional and, in fact, since 1.74 you get > that validator by default if web2py knows how to represent a partner. > For example > > db.define_table('partner',Field('name'),format='%(names)s') > db.define_table('whatever',Field('partner',db.partner)) > > db.whatever.partner.requires is set by default to IS_IN_DB > (db,'partner.id','%(name)s') thanks. Where can I find info about the exact syntax of Field (and in general a complete up2date APIdoc?) > > ps: if I find errors in comparing django and web2py, where should I > > report it? > > You can email it here so we can discuss it. No model validation in django (yet) (v1.1) Django has ModelForms which is similar to SQLFORM. > > > I dig up some info for IS_IN_SET, it accepts dicts, but it is not > > mentioned on the > > site:http://www.web2py.com/examples/static/epydoc/web2py.gluon.validators.... > > > Using an autoincrement integer called id in every db is a good > > practice, but it is impossible to follow legacy databases. > > For definition of a legacy database: > > Suppose you have some system with existing database, and you should > > create a web-based interface for that. > > So, you cannot alter the tables in the legacy database (not > > considering oracle, where AFAIK you should insert a sequence number > > manually, so an alter table is not sufficient). > > > So, for this case it should be good to have arbitrary (and also multi- > > field) PK support. > > We actually support this for some databases but not all. You can find > some info > here:http://groups.google.com/group/web2py/browse_thread/thread/2b877c0b79... > > We are in the process of re-factoring the DAL so that it will remain > backward compatible and this issue will eventually be addressed for > all databases. Nice, but can I find complete api doc somewhere? I still miss how the format keyword argument works for define_table. thanks -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.