[Answer]-Table specific data in django models



In SQL database it would be easiest to create an additional table which would hold a reference to (for example) thread table and user table. Call it (for example) ThreadVisitors.

Whenever a user visits a thread you create an entry in that table for that user and the thread (you could add a unique constraint on (thread, user) pair). That way getting all visitors for a given thread is as simple as running count query (for a given thread). Some indexes would be helpful here and if performance is an issue then you should cache count queries.

You will need such table per each model probably.


Leave a comment