Increment Page Hit Count in Django

前端 未结 4 949
伪装坚强ぢ
伪装坚强ぢ 2020-12-29 08:46

I have a table with an IntegerField (hit_count), and when a page is visited (for example, http://site/page/3) I want record ID 3\'s

4条回答
  •  梦谈多话
    2020-12-29 09:08

    I would start by looking at the documentation for middleware. Ignacio's comment about the lack of atomic transactions is true, but this is a problem with the entire Django framework. Unless you're concerned about having a 100% accurate counter I wouldn't worry about it.

提交回复
热议问题