Hi!, I'm having this little problem.
I want to do sth like this...
User.select().orderBy('email_addresses')
where email_addresses is defined in the User.py class ( the model one)
class User(SQLObject):
...
...
email_addresses = RelatedJoin('Email')
...
...
class Email(SQLObject):
...
...
users = RelatedJoin("User")
...
...
SQLObject creates a new table called email_tg_user, where the
many-to-many relationship takes place.
I want to select all the users ordered by their email addresses.
I thought that I could do User.select().orderBy('email_addresses'), but
it turns out that the column email_addresses does not exist. I checked
this out using the tg-admin sql sql command.
but if I first try to select all the users and then show their email
addresses it works, but I cant show them in order
>>> users = User.select()
>>> for user in users:
... print user.email_address
...
[<Email 1 email="u'[EMAIL PROTECTED]'">, <Email 4
email="u'[EMAIL PROTECTED]'">, <Email 7 email=u'[EMAIL PROTECTED]'>]
[<Email 2 email="u'[EMAIL PROTECTED]'">, <Email 3
email="u'[EMAIL PROTECTED]'">, <Email 7 email=u'[EMAIL PROTECTED]'>]
[<Email 5 email="u'[EMAIL PROTECTED]'">, <Email 6
email="u'[EMAIL PROTECTED]'">]
>>>
So my question is, How can I select all the users ordered by their
email addreses?
How can I do this using SQL code? I mean, how can I execute native SQL
code in SQLObject?
thanks in advance!!
--
miya
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---