Вот код, в котором я получаю сообщение об ошибке:
Код: Выделить всё
class Shooter(db.Model):
__tablename__ = "shooters"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
team_id = db.Column(db.Integer, db.ForeignKey('teams.id'),
nullable=False)
@property
def total_score(self):
scores = map(lambda a: a.score, self.scores)
total = reduce(lambda a, b: a+b, scores)
return total
Код: Выделить всё
sqlite3.IntegrityError: NOT NULL constraint failed: shooters.team_idКод: Выделить всё
team_id = db.Column(db.Integer, db.ForeignKey('teams.id'),
nullable=False)
Код: Выделить всё
team_id = db.Column(db.Integer, db.ForeignKey('teams.id'),
null=True)
Код: Выделить всё
TypeError: Additional arguments should be named _, got 'null'Итак, если исправление ошибки 1 приведет меня к ошибке 2 и наоборот, как я могу исправить эту рекурсивную ошибку?
Спасибо.>
Подробнее здесь: https://stackoverflow.com/questions/735 ... ditional-a
Мобильная версия