0

我正在尝试链接 web2py 中的两个 mysql 表,它们的列具有相同的条目(尽管行不同)。我想在网格中显示第一个表,并有一个链接显示第二个表的相应条目。到目前为止,这就是我所拥有的:

in models --> db.py

    db.define_table('total_ec_numbers',
    Field('id','integer', label=T('ID')),
    Field('query_name','string', label=T('Gene ID')),
    Field('hit_name','string', label=T('Hit name')),
    Field('hit_accession','string', label=T('Hit accession')),
    Field('ec','string', label=T('EC number')),
    Field('hsp_evalue','string', label=T('E-value')),
    Field('hsp_length','string', label=T('HSP length')),
    Field('hsp_percent','string', label=T('HSP percent')),
    Field('sample','string', label=T('Sample')),
    Field('extra','string', label=T('Extra info')),
    migrate=False, format = '%(query_name)s')

    db.total_ec_numbers._singular = "EC numbers results"
    db.total_ec_numbers._plural = "EC numbers results"


#--------
    db.define_table('total_genes',
    Field('id','integer', label=T('id')),
    Field('gene_id','string', label=T('Contig')),
    Field('gene_name','string', label=T('Gene name')),
    Field('sequence','text', label=T('Sequence')),
    Field('seq_length','integer', label=T('Sequence length')),
    Field('description', 'reference total_ec_numbers', label=T('Gene ID')),
    Field('sample','string', label=T('Sample')),
    Field('extra','string', label=T('Extra info')),
    migrate=False)

    db.total_genes._singular = "All sequences"
    db.total_genes._plural = "All sequences" 


in controllers --> default.py


    important_columns=[db.total_ec_numbers.query_name,db.total_ec_numbers.hit_name,db.total_genes.description]

    form2=SQLFORM.smartgrid(hotzyme_tests.total_ec_numbers, linked_tables=['total_genes'], create=False, fields=important_columns, deletable=False, editable=False, maxtextlength=64, paginate=10)

有了这个,我得到了一个很好的“total_ec_numbers”表格网格,每个条目旁边都有链接“所有序列”。但是当我点击链接时,我收到以下错误:

ValueError: invalid literal for int() with base 10: '1_start=553_stop=756_strand=+'


The fields that have the identical entries are the db.total_ec_numbers.query_name and the db.total_genes.description and they have string data values. Nevertheless web2py seems to search for integers. Do you know how i can change that? Thank you in advance,
4

0 回答 0