【发布时间】:2009-03-07 22:42:05
【问题描述】:
我有一个带有IntegerField (hit_count) 的表,当访问一个页面时(例如http://site/page/3),我希望数据库中记录ID 3 的hit_count 列增加1。
查询应该是这样的:
update table set hit_count = hit_count + 1 where id = 3
我可以使用标准的 Django 模型约定来做到这一点吗?还是我应该手动编写查询?
【问题讨论】:
-
如果您提供模型本身会有所帮助。
标签: python django django-models