On Jan 2, 4:47 am, pihentagy <pihent...@gmail.com> wrote:
> On Jan 1, 6:34 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > On Jan 1, 9:48 am, pihentagy <pihent...@gmail.com> wrote:
> > 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))
>
> Hm so getting referential integrity only when the system can _display_
> some type of record? Again, I see a problem here: validator should
> really care about validity, and representation should be another
> thing.

I am not sure I understand. Field('partner',db.partner) defined a
reference field. The reference is always implemented using the Primary
Key (the ID field) and this has nothing to do with representation. The
format string is used only when building a representation of the
reference in forms. What you see (%(name)s) is not the key and is not
what is stores in the database for whatever.partner.

> And if we are representation: if web2py renders a mandatory FK as a
> combobox, there is no dummy 'please select one' option.
> The first valid option is selected by default. This causes serious
> usability issues, because users will not pay any attention to select a
> valid option, because there is something, and it validates.

Please never assume that something that is not done by default cannot
be done.

db.whatever.partner.requires.zero="Please Select One"


>
> Gergo

--

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.


Reply via email to