1

次のエラーが発生します。

"'used_intent' is an invalid keyword argument for this function"

私のモデルはここにあります:

class Intents(models.Model):
    id = models.AutoField(primary_key=True)
    intent = models.CharField(max_length=300)
    description = models.CharField(max_length=300)
    class Meta:
        db_table = u'intents'

class UsedIntents(models.Model):
    id = models.AutoField(primary_key=True)
    report_id = models.IntegerField()
    used_intent = models.IntegerField()
    class Meta:
        db_table = u'used_intents'

対応するコード行は次のとおりです。

usedIntentsElement = xmldoc.getElementsByTagName('intent')
for element in usedIntentsElement:
    try:
        intentsEntry = Intents.objects.get(intent=element.childNodes[0].nodeValue)
        intentsEntryId = intentsEntry.id
    except:
        # if intent is unknown add it to the database and get the id of the new entry
        intentsEntry = Intents(intent=element.childNodes[0].nodeValue)
        intentsEntry.save()
        intentsEntryId = intentsEntry.id
    usedIntentsEntry = UsedIntents(report_id=int(reportEntryId), used_intent=int(intentsEntryId))
    usedIntentsEntry.save()

このエラーの原因を知っている人はいますか?

4

0 に答える 0