Closed fanmaoyu0871 closed 4 months ago
MySQL doesn't have a dedicated bool type, so Django has to store bools as an integer. But models.BooleanField
automatically converts the integer back to a bool after loading from the database; this is expected behaviour
MySQL doesn't have a dedicated bool type, so Django has to store bools as an integer. But
models.BooleanField
automatically converts the integer back to a bool after loading from the database; this is expected behaviour
you see my value is 0, it's alway return true
Any questions should be ask here instead https://github.com/encode/django-rest-framework/discussions
mysql table struct,the column is bit type:
mysql data:
django model :
drf serializer:
http response:
my database value is 0,but it always return ”true“,i don't know why.