我已经安装了 django-geckoboard easy_install django-geckoboard
,我正在创建一个自定义小部件来计算评论(number_widget),但显示导入错误cannot import name simplejson
我附上代码。
from datetime import date, time, datetime
from django.contrib.comments.models import Comment
from django_geckoboard.decorators import number_widget
@number_widget(format='xml')
def comment_count(request):
midnight = datatime.combine(date.today(), time.min)
return Comment.objects.filter(submit_data__get=midnight).count()`