Limit number of views per day in Django
- by ariddell
Is there an easy way to limit the number of times a view can be accessed by a given IP address per day/week? A simplified version of the technique used by some booksellers to limit the number of pages of a book you can preview?
There's only one view that this limit need apply to--i.e. it's not a general limit--and it would be nice if I could just have a variable overlimit in the template context. The solution need not be terribly robust, but limiting by IP address seemed like a better idea than using a cookie.
I've looked into the session middleware but it doesn't make any references to tracking IP addresses as far as I can tell.
Has anyone encountered this problem?