Django JSON ::’dict’对象没有属性’_meta’

Django JSON:: 'dict' object has no attribute '_meta'

1
2
3
4
5
6
7
def display_home(request):
    from datetime import *
    now=datetime.today()
    print 'Month is %s'%now.month

events=Event.objects.filter(e_date__year=datetime.today().year).filter(e_date__month=datetime.today().month,e_status=1).values('e_name','e_date')
return render_to_response("SecureVirtualElection/home.html",{'events': serializers.serialize("json",events, fields=('e_name','e_date'))},context_instance=RequestContext(request))

错误:对象字典是:是不是有一半是_属性P></


1
events=Event.objects.filter(e_date__year=datetime.today().year).filter(e_date__month=datetime.today().month,e_status=1).only('e_name','e_date')

waits QuerySet序列化程序正常,没有ValuesQuerySet(这是时尚的城市values)。如果你想要的只是两个查询使用的某些领域,only.