I think I figured it out. Using the field property 'common_filter' AND the special field 'requst_filter' on the same table is what was causing it. Removing one of those fixed the issue for me.
On Saturday, 23 January 2016 06:07:02 UTC, Seraaj Muneer wrote: > > Web2py 2.13.4. Essentially the code in the original post here is all there > is in the app. Initially, it was working just fine, then it suddenly > stopped with that error. > > On Saturday, 23 January 2016 04:14:47 UTC, Anthony wrote: >> >> What version of web2py? Can you attach a minimal app that reproduces the >> problem? >> >> On Friday, January 22, 2016 at 6:26:18 PM UTC-5, Seraaj Muneer wrote: >>> >>> That was just a typing error when I was writing the message here. It's >>> actually correctly defined in my code. >>> On 22 Jan 2016 23:08, "Derek" <[email protected]> wrote: >>> >>>> company_field_id and company_id_field are not the same. Look closely. >>>> >>>> On Friday, January 22, 2016 at 3:29:47 PM UTC-7, Seraaj Muneer wrote: >>>>> >>>>> Hello everyone again, still taking web2py for a spin but encountering >>>>> some really strange errors. >>>>> >>>>> Here is my data definition >>>>> >>>>> company_field_id = 'company_id' >>>>> >>>>> >>>>> db.define_table('bank', Field('bank_name', 'string', length=25, >>>>> represent=lambda bank_name, row: bank_name.upper(), >>>>> required=True, >>>>> unique=True, notnull=True, >>>>> ), >>>>> Field('default_branch', 'string', default='', length=25, >>>>> requires=[IS_EMPTY_OR(IS_MATCH('^[a-zA-Z][a-zA-Z ]*$'))]), >>>>> Field(company_id_field, 'reference company', notnull=True, ondelete= >>>>> on_delete_cascade, >>>>> writable=False, readable=False), Field('request_tenant', default=auth >>>>> .user_id, writable=False), >>>>> auth.signature, common_filter=lambda query: db.bank.company_id == >>>>> get_default_company_id(), >>>>> format=lambda r: r.bank_name or 'No bank name!') >>>>> db.bank.bank_name.requires = [IS_NOT_EMPTY(error_message='You must >>>>> enter a bank name'), >>>>> IS_MATCH('^[a-zA-Z][a-zA-Z ]*$', >>>>> error_message='Bank name can only contain alphabets (A-Z)'), >>>>> IS_NOT_IN_DB(db, db.bank.bank_name, error_message='Bank name must be >>>>> unique.')] >>>>> >>>>> db.bank._before_insert.append( >>>>> lambda f: f.update( >>>>> company_id=get_default_company_id())) >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> and here is my controller >>>>> >>>>> >>>>> @auth.requires_login() >>>>> def show(): >>>>> db(db.company.id > 0).count() or redirect(URL('company', 'create')) >>>>> form = SQLFORM.smartgrid(db.bank) >>>>> return dict(form=form) >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> and here is my view >>>>> >>>>> >>>>> {{extend 'layout.html'}} >>>>> {{=form}} >>>>> >>>>> >>>>> >>>>> Nothing I do gets this to work. Web2py always returns the error as per >>>>> the screenshot attached. I've done a great deal of googling to no avail. >>>>> Whats wrong? >>>>> >>>>> -- >>>> 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 a topic in the >>>> Google Groups "web2py-users" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/web2py/fOfE_wct24Q/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

