为什么 create_or_update 生成管理器属性错误?

hac*_*man 4 django

AttributeError: 'Manager' object has no attribute 'create_or_update'使用下面的 create_or_update 时,我在 views.py 中收到错误。我的代码如下所示:

SlotFilling.objects.create_or_update(
                    originator=textobject.originator,
                    defaults = {empty_slot: True,
                    relevant_intent: intent_rank1,
                    ner_entities_list: ner_entities,}
                )
Run Code Online (Sandbox Code Playgroud)

我不确定如何解决此错误。我正在使用Django 1.11.2,所以create_or_update应该支持。我唯一能想到的是我一定错过了我的model.py. 我已经把它包括在下面。对可能发生的事情有任何见解吗?

我的models.py:

from django.db import models
class SlotFilling(models.Model):
    originator = models.CharField(max_length=20, primary_key=True)
    empty_slot = models.BooleanField(default=False)
    relevant_intent = models.CharField(max_length=20)
    slotted_entity = models.CharField(max_length=20)
    ner_entities_list = models.CharField(max_length=40)
Run Code Online (Sandbox Code Playgroud)

Ast*_*and 8

它是update_or_create不是 create_or_update