On Monday 03 December 2007 16:56:07 lolostar wrote:
> Hi,
>
> I try to use a foreign key and a multiple join in my model but as my
> fkey column is named ''agence' in my model, it is created as
> 'agence_id' in my database and, here's the problem, whenever I call
> 'AgenceEDF.get(1).photos()' for example, the sql generated uses the
> 'agence' name :
>
> ProgrammingError: column "agence" does not exist
> LINE 1: SELECT id FROM agences.photo WHERE agence = (1)
>
> Here's my model :
>
> class AgenceEDF(SQLObject):
> class sqlmeta:
> table ='agences.agenceedf2'
> idName ='id'
> codepostal = UnicodeCol(length=5)
> lat = FloatCol(default=None)
> lon = FloatCol(default=None)
> nom = UnicodeCol(length=100,varchar=True)
> adresse = UnicodeCol(length=100,varchar=True)
> complement_adresse = UnicodeCol(length=100,varchar=True)
> commune = UnicodeCol(length=100,varchar=True)
> telephone = UnicodeCol(length=25,varchar=True, default=None)
> plage_horaire = UnicodeCol(length=100,varchar=True, default=None)
> jours_ouverture = UnicodeCol(length=100,varchar=True,
> default=None)
> dcpp = UnicodeCol(length=25,varchar=True, default=None)
> type_accueil = UnicodeCol(length=25,varchar=True, default=None)
> photos = MultipleJoin('Photo',joinColumn='agence')
>
>
> class Photo(SQLObject):
> class sqlmeta:
> table ='agences.photo'
> idName ='id'
> agence = ForeignKey('AgenceEDF')
> image = BLOBCol(default=None)
> thumbnail = BLOBCol(default=None)
> created = DateTimeCol(default = datetime.now)
> tag = UnicodeCol(length = 10,default=None)
> description = UnicodeCol(default=None)
>
> agence_idx = DatabaseIndex("agence")
>
>
> Any idea ?
Just get rid of the joinColumn attribute in the AgenceEDF.photos column
descriptor.
Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---