[web2py] Re: format and represent on table
nope, it just the futsal app the one that is similar to hotel management appliance. the room in the the hotel management appliance i rename it into court for futsal court. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: format and represent on table
just curious Steve, are you writing a court app for government? Alex Glaros On Tuesday, March 26, 2013 10:43:53 PM UTC-7, 黄祥 wrote: > > hi, > > i've already define format in table but it seems return the id instead of > the format i've define, when i define represent on the field of the other > field it can work. is it normal? > > *e.g. work* > db.define_table('booking', > Field('scheduled_start', 'datetime'), > Field('due_date', 'datetime'), > Field('court', 'reference court'), > Field('customer', 'reference customer'), > Field('description', 'text'), > format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, > r.customer.last_name, > r.court.branch.address, > r.court.court_no)) > > db.define_table('check_in', > Field('is_booking', 'boolean'), > Field('booking', 'reference booking'*, represent=lambda id, r: '%s > %s-%s-%s' % (r.customer.first_name, r.customer.last_name, > r.court.branch.address, r.court.court_no)*), > Field('court', 'reference court'), > Field('customer', 'reference customer'), > Field('description', 'text'), > format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, > r.customer.last_name, > r.court.branch.address, > r.court.court_no)) > > > *e.g. not work* > db.define_table('booking', > Field('scheduled_start', 'datetime'), > Field('due_date', 'datetime'), > Field('court', 'reference court'), > Field('customer', 'reference customer'), > Field('description', 'text'), > format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, > r.customer.last_name, > r.court.branch.address, > r.court.court_no)) > > db.define_table('check_in', > Field('is_booking', 'boolean'), > Field('booking', 'reference booking'), > Field('court', 'reference court'), > Field('customer', 'reference customer'), > Field('description', 'text'), > format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, > r.customer.last_name, > r.court.branch.address, > r.court.court_no)) > > thank you very much in advance > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: format and represent on table
a, i c, thank you so much for your detail explaination, massimo. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: format and represent on table
The problem is that table._format is used to build field.represent only for references only when format is a string. In your case it is a function which performs a nested query. That is very expensive. Web2py wants you to be explicit before using it that to build a dropdown. It works (in the first case) but it considerably slows down your code. On Wednesday, 27 March 2013 00:43:53 UTC-5, 黄祥 wrote: > > hi, > > i've already define format in table but it seems return the id instead of > the format i've define, when i define represent on the field of the other > field it can work. is it normal? > > *e.g. work* > db.define_table('booking', > Field('scheduled_start', 'datetime'), > Field('due_date', 'datetime'), > Field('court', 'reference court'), > Field('customer', 'reference customer'), > Field('description', 'text'), > format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, > r.customer.last_name, > r.court.branch.address, > r.court.court_no)) > > db.define_table('check_in', > Field('is_booking', 'boolean'), > Field('booking', 'reference booking'*, represent=lambda id, r: '%s > %s-%s-%s' % (r.customer.first_name, r.customer.last_name, > r.court.branch.address, r.court.court_no)*), > Field('court', 'reference court'), > Field('customer', 'reference customer'), > Field('description', 'text'), > format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, > r.customer.last_name, > r.court.branch.address, > r.court.court_no)) > > > *e.g. not work* > db.define_table('booking', > Field('scheduled_start', 'datetime'), > Field('due_date', 'datetime'), > Field('court', 'reference court'), > Field('customer', 'reference customer'), > Field('description', 'text'), > format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, > r.customer.last_name, > r.court.branch.address, > r.court.court_no)) > > db.define_table('check_in', > Field('is_booking', 'boolean'), > Field('booking', 'reference booking'), > Field('court', 'reference court'), > Field('customer', 'reference customer'), > Field('description', 'text'), > format=lambda r: '%s %s-%s-%s' % (r.customer.first_name, > r.customer.last_name, > r.court.branch.address, > r.court.court_no)) > > thank you very much in advance > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.