You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The IntField has the property constraints. It contains the constraints ge and le. These constraints are not taken into account (in any place as far as I can tell) or they should be reflected by a validator.
To Reproduce
fromtortoiseimportmodels, fields, run_asyncfromtortoise.contrib.testimportinit_memory_sqliteclassAcc(models.Model):
id=fields.IntField(pk=True)
some=fields.IntField()
asyncdefmain():
constraints_id=Acc._meta.fields_map.get('id').constraints# {'ge': -2147483648, 'le': 2147483647}too_high_id=constraints_id.get('le') +1constraints_some=Acc._meta.fields_map.get('some').constraints# {'ge': -2147483648, 'le': 2147483647}too_low_some=constraints_some.get('ge') -1acc=Acc(id=too_high_id, some=too_low_some) # this should throw an errorawaitacc.save() # or maybe thisif__name__=='__main__':
run_async(init_memory_sqlite(main)())
Expected behavior
Either the constraints should match the capabilities of the DB or the constraints should be checked beforehand. And an error should be thrown.
Additional context
The produced Pydantic Model by pydantic_model_creator would check those constraints.
The text was updated successfully, but these errors were encountered:
Describe the bug
The IntField has the property constraints. It contains the constraints
ge
andle
. These constraints are not taken into account (in any place as far as I can tell) or they should be reflected by a validator.To Reproduce
Expected behavior
Either the constraints should match the capabilities of the DB or the constraints should be checked beforehand. And an error should be thrown.
Additional context
The produced Pydantic Model by pydantic_model_creator would check those constraints.
The text was updated successfully, but these errors were encountered: