I have the following model:
class User(SQLObject):
# names like "Group", "Order" and "User" are reserved words in SQL
# so we set the name to something safe for SQL
class sqlmeta:
table = 'tg_user'
user_name = UnicodeCol(length=16, alternateID=True,
alternateMethodName='by_user_name')
email_address = UnicodeCol(length=255, alternateID=True,
alternateMethodName='by_email_address')
display_name = UnicodeCol(length=255)
password = UnicodeCol(length=40)
created = DateTimeCol(default=datetime.now)
viewings = MultipleJoin('Viewing')
class Video(SQLObject):
video_title = UnicodeCol(length=255, alternateID=True,
alternateMethodName='by_video_title')
viewings = MultipleJoin('Viewing')
class Viewing(SQLObject):
created = DateTimeCol(default=datetime.now)
video = ForeignKey('Video')
user = ForeignKey('User')
Running "tg-admin sql status" gives me no warnings, but in Catwalk I'm
unable to view the User table, with the server generating the error:
File "/usr/lib/python2.5/site-packages/SQLObject-0.9.0-py2.5.egg/
sqlobject/sqlbuilder.py", line 381, in __getattr__
raise AttributeError("%s instance has no attribute '%s'" %
(self.soClass.__name__, attr))
AttributeError: Viewing instance has no attribute 'tgID'
Why is SQLObject looking for a 'tgID' instead of a viewing_id? Is
there anyway to fix this? I've Googled for the error, but there
doesn't appear to be anything like this.
Chris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---