以下のモデルがあり、IntegrityError: NOT NULL constraint failed: terms.sets_id
エラーが発生します。私は他の投稿をチェックしましたが、それを引き起こしているはずの唯一のことは、すべてのパラメーターを渡していないことですが、5 つのフィールドを宣言し、5 つの値を に渡しますconcept = cls(...)
。私は何が欠けていますか?
class Terms(UserMixin, BaseModel):
term_id = CharField()
sets_id = CharField()
term_count = IntegerField()
term = TextField()
definition = TextField()
@classmethod
def include_term(cls, set_id, term_id, definition, rank, term, **kwards):
try:
cls.select().where(cls.term_id == term_id).get()
except cls.DoesNotExist:
print("putting term into db")
concept = cls(
set_id = set_id,
term_id = term_id,
term= term,
definition = definition,
rank = rank )
concept.save()
print(concept.term)
print("term saved to db")
return concept
else:
raise Exception("Term with that id already exists")