Hi,

I get an Integrity Error everytime I modify a record in the t_route, and I 
don't understand what's wrong. The t_route contains only 1 record, the 
t_route_archive is empty.

What should I do?

The controller:
@auth.requires_login()
def route_manage():
    form = SQLFORM.smartgrid(db.t_route,
        csv=False,
        searchable=False,
        details=False,
        onupdate=auth.archive
        )
    return locals()

Here is the model:
########################################
db.define_table('t_route',
    Field('f_name', type='string',
          label=T('Name')),
    Field('f_precedence', type='integer',
          default=100,
          label=T('Precedence')),
    Field('f_source', type='reference t_source',
          required=False, label='Source'
          ),
    Field('f_mid_filter', type='string',
          label=T('Mid Filter')),
    Field('f_pan_filter', type='string',
          label=T('Pan Filter')),
    Field('f_destination', type='reference t_destination',
          required=True,
          label=T('Destination')),
    Field('f_overflow', label='Overflow', default='overflow',
          requires = IS_IN_SET(('overflow', 'block'))),
    Field('f_enabled', type='boolean',
          default=True,
          label=T('Enabled')),
    Field('f_version', type='reference t_version',
          label=T('Rule Version')),
    auth.signature,
    format='%(f_name)s',
    singular='Route',
    migrate=settings.migrate)

db.define_table('t_route_archive', 
db.t_route,Field('current_record','reference t_route',
                                                    readable=False, 
writable=False),
                                                    singular='route 
archive')


And the SQLite Schemas:

sqlite> .schema t_route
CREATE TABLE "t_route"(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    f_name CHAR(512),
    f_precedence INTEGER,
    f_source INTEGER REFERENCES t_source (id) ON DELETE CASCADE,
    f_mid_filter CHAR(512),
    f_pan_filter CHAR(512),
    f_destination INTEGER REFERENCES t_destination (id) ON DELETE CASCADE,
    f_enabled CHAR(1),
    f_rule_version INTEGER REFERENCES t_version (id) ON DELETE CASCADE,
    is_active CHAR(1),
    created_on TIMESTAMP,
    created_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
    modified_on TIMESTAMP,
    modified_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE
, f_src INTEGER REFERENCES t_source (id) ON DELETE CASCADE, f_version 
INTEGER REFERENCES t_version (id) ON DELETE CASCADE, f_overflow CHAR(512));
sqlite> .schema t_route_archive
CREATE TABLE "t_route_archive"(
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    f_name CHAR(512),
    f_precedence INTEGER,
    f_source INTEGER REFERENCES t_source (id) ON DELETE CASCADE,
    f_mid_filter CHAR(512),
    f_pan_filter CHAR(512),
    f_destination INTEGER REFERENCES destination (id) ON DELETE CASCADE,
    f_enabled CHAR(1),
    f_rule_version INTEGER REFERENCES t_version (id) ON DELETE CASCADE,
    is_active CHAR(1),
    created_on TIMESTAMP,
    created_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
    modified_on TIMESTAMP,
    modified_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
    current_record INTEGER REFERENCES t_route (id) ON DELETE CASCADE
, f_src INTEGER REFERENCES t_source (id) ON DELETE CASCADE, f_version 
INTEGER REFERENCES t_version (id) ON DELETE CASCADE, f_overflow CHAR(512));


Thanks !

-- 
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.

Reply via email to