2👍
Give each message a timestamp (or just an incrementing ID). Then when the client pools, you send him all the messages that belong to the current chat, that happened in the last 10 seconds, along with their timestamps. The client can then filter out messages he’s already got. It pools every 5 seconds or so. If you don’t need the messages for logging etc, you can delete messages older than 10 seconds.
Note that if you want to implement a chat that would really feel fast and responsive, you should consider using Reverse Ajax. In that case, the answer would be different. The server should have a list of clients registered to each chat (clients that have an HttpRequest pending). The server then sends each of them every message that is posted.
And don’t forget to search before you reinvent the wheel. One of django’s best features is its pluggable apps archtecture.