What is db.t_codespostaux.f_representationfield (it's not in your model), and most importantly, have you created a database index on that field (will help with the autocomplete search)?
Exactly at what point does the process crash -- as soon as you load the addresses_manage page? If so, I suspect the problem might be the grid search widget, which by default will attempt to generate all the options for reference fields. To avoid that, I think it will work to manually create the reference field validator and put it in a list: Field('f_codepostal', 'reference t_codespostaux', requires=[IS_IN_DB(db, 't_codespostaux.id')]) That will also suppress the default select widget in forms, even if you don't explicitly specify the autocomplete widget as you have. Anthony On Friday, December 14, 2018 at 6:58:42 PM UTC-5, Jota Pin wrote: > > Dear all, > > > [I posted my first message some days ago and did not saw it appearing on > the list, so I re-post, sorry] > > > I am developing a small-scale app, basically for +-15 users with tables > around 1000-10000 lines, except for one: post-codes (500000). The app works > fine with up to ~5000 postcodes, but with the real table, it simply crashes > the web2py process. Being small-scale, I suppose that using the "defaults" > is enough (the embedded rocket server, ubuntu 16.04, sqlite). Is there a > simple solution by modifying the model/controller, or is this about > switching to nginx? > > > A) The model: (for the two concerned tables, simplified to not flooding > you with details, "codespostaux" are the post-codes): > > db.define_table('t_adresses', > Field('f_codepostal', type='reference t_codespostaux', notnull=True, > label=T('Codepostal')), > migrate=settings.migrate) > db.t_adresses.f_codepostal.widget = SQLFORM.widgets.autocomplete(request, > db.t_codespostaux.f_representationfield, > id_field=db.t_codespostaux.id,limitby=(0,10), > min_length=2) > > db.define_table('t_adresses_archive',db.t_adresses,Field('current_record','reference > > t_adresses',readable=False,writable=False)) > > db.define_table('t_codespostaux', > Field('f_codepostal', type='string', > label=T('Codepostal'), > format='%(f_codepostal)s', > migrate=settings.migrate) > > db.define_table('t_codespostaux_archive',db.t_codespostaux,Field('current_record','reference > > t_codespostaux',readable=False,writable=False)) > > B) The Controller: > def adresses_manage(): > form = SQLFORM.smartgrid(db.t_adresses,onupdate=auth.archive,csv=False) > return locals() > > > > Best regards, > > Jota > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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/d/optout.