【发布时间】:2018-02-01 09:37:34
【问题描述】:
我正在尝试将问题带入我的模型的值不保存,执行此操作的函数如下所列,模型中的 no_value 字段是 IntegerField,默认值为 0。
def _no_value():
questions = Question.objects.all()
for question in questions:
regex = re.compile('(__[_]*)')
no_value = (regex.findall(question.question))
if no_value:
value = len(no_value)
question.no_value(value)
question.save()
请告诉我如何解决这个错误。
【问题讨论】:
-
question.no_value = value
标签: python django python-3.x django-models django-views