我使用通用视图,我想更新另一个数据库表中的字段(most_view)。
当用户阅读文章时,如何更新或创建新的“最多视图”寄存器?
ulrs.py
from Paso_a_Paso.noticias.models import Noticia
noticias_info_dict = {
'queryset':Noticia.objects.all(),
'date_field':'pub_date',
}
urlpatterns = patterns('django.views.generic.date_based',
(r'^$','archive_index', noticias_info_dict,'noticias_archive_index'),
(r'^(?P<year>\d{4})/$','archive_year', noticias_info_dict,'noticias_archive_year'),
(r'^(?P<year>\d{4})/(?P<month>\w{3})/$','archive_month', noticias_info_dict,'noticias_archive_month'),
(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$','archive_day', noticias_info_dict,'noticias_archive_day'),
(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$','object_detail', noticias_info_dict,'noticias_archive_detail'),
)
多谢你们 :)