On Jun 2, 3:04 pm, Larry <[email protected]> wrote:
> Hi,
>
> Here is what I want to do:
>
> I have one table A with two columns: user_id, msg_id (ManyTOMany)
> and other table B with two column: msg_id, msg_time
>
> Now I want to search for msg_id's of a certain user_id in table A, and
> display the msgs
> ordered by the msg_time.
>
> Could anyone tell me how to do this?
>
> Many many thanks!
>
> -Larry
You might need to provide some actual model definitions.
Generally, you can use the double-underscore format in order_by, so
you can do this:
ModelA.objects.filter(field=x).order_by('modelb__field')
Is that what you want?
--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---