Hello. I'm writing a simple private messenger using Django and am implementing message threading.
Each series of messages and replies will have a unique thread_id that will allow me to string sets of messages together. However, in the inbox view ALL of the messages are showing up, I'd just like to group by the thread_id so that although a thread could have 20 messages, it only shows up once in the inbox.
It'd be a pretty simple
SELECT msg_id, msg_text, subject, from_user_id, to_user_id, date_time, is_read,
thread_id WHERE to_user_id='foo' GROUP BY thread_id FROM inbox_message;
however, I can't seem to execute it using django's ORM
any thoughts?