qingyuanluofeng
天地一扁舟
采纳率7.2%
2015-04-07 05:12 阅读 2.3k

Django model,QuerySet 序列化成json报错

运行django的views.py中的代码报错如下:
'MetaDict' object has no attribute 'concrete_model'
出错的代码行是:hall_list_data = serializers.serialize("json", clientcase.objects.filter(category="hall"))

我的models.py中定义的模型如下:

- coding: utf-8 -

from django.db import models
from mongoengine import *
from acto_website.settings import DBNAME
import json
import pymongo

connect(DBNAME)

Create your models here.

#客户案例模型
class clientcase(Document):
category = StringField(max_length = 1000)
name = StringField(max_length= 1000)
address = StringField(max_length = 1000)
introduction = StringField(max_length = 100000)
store_time = IntField()
pictures = ListField(DictField())
videos = ListField(DictField())

def __str__(self):
    return self.name

我用的model是基于mongoengine的,没有用它自己的
哪位大侠指点一下,十分感谢

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

相关推荐