I currently have the following models
class ChatRoom(models.Model):
creator = models.ForeignKey(\'User\') # points to the initial user
class Message(model
You need to have a additional relation to your last message, otherwise you will not be able to order by them.
class ChatRoom(models.Model):
creator = models.ForeignKey('User') # points to the initial user
# you will need to set this in view or with signals.(don't forget to handle delete)
last_message = models.ForignKey('Message')
And that you can do this
ChatRoom.objects.filter(...).order_by('last_message__date')