I have the below model and getting a IntegrityError: NOT NULL constraint failed: terms.sets_id
error. I've checked other posts and the only thing I can find that should be causing it is that I'm not passing in all the parameters, but I declare five fields, and pass in 5 values into concept = cls(...)
. What am I missing?
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")