【发布时间】:2017-04-30 14:08:47
【问题描述】:
我对其余框架和一个枚举字段有疑问。我收到此错误:
File "/usr/local/lib/python2.7/dist-packages/coreapi/codecs/corejson.py", line 48, in decode_schema_from_corejson
return schema_cls(title=title, description=description)
TypeError: __init__() takes exactly 2 arguments (1 given)
当模型有这个字段时:
class PuddleAtomStatus(ChoiceEnum):
INVALID = "INVALID"
OK = "OK"
class PuddleAtom(Model):
name = models.CharField(max_length=255, primary_key=True)
ingestion_flow = models.CharField(max_length=256)
status = EnumChoiceField(enm_class=PuddleAtomStaus)
但是当
status = models.CharField(max_length=100)
我正在使用 Django 1.11 和 python 2.7
有没有办法解决这个问题并让模型保留 enum 字段?
【问题讨论】:
-
更新:问题是github.com/core-api/core-api/issues/47你有什么解决方法吗?
标签: django django-models django-rest-framework django-serializer