Hi,

I'm experiencing an issue with ForeignKey. First of all, all my primary
keys use idName attribute as classes use a different name. So I built
the following classes :

------

class User(sqlobject.SQLObject):

    class sqlmeta:
        table  = 'tbl_user'
        idName = 'user_id'
        idType = int
       
    user_firstname  = sqlobject.StringCol(length=45)
    user_lastname   = sqlobject.StringCol(length=45)
    user_email      = sqlobject.StringCol(length=45)
    user_phone      = sqlobject.StringCol(length=20)
    user_password   = sqlobject.StringCol(length=128)
    user_city       = sqlobject.StringCol(length=45)
    user_country    = sqlobject.StringCol(length=45)
    user_section  = sqlobject.ForeignKey('Section')

class Section(sqlobject.SQLObject):

    class sqlmeta:
        table  = 'tbl_section'
        idName = 'section_id'
        idType = int

        section_name = sqlobject.StringCol(length=128)

------


And then the debug output :

 1/QueryOne:  SELECT user_firstname, user_lastname, user_email,
user_phone, user_password, user_city, user_country, user_section_id FROM
tbl_user WHERE ((tbl_user.user_id) = (1))

As you can see the column "user_section_id" has been generated by
SQLObject. But that column doesn't exists. It should be "user_section"
from table "tbl_user". I tried with the attribute "name" with ForeignKey
method but the requests remain the same.

Do you know how to fix that ?

Cheers,





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to