Hi there! I'm facing something really strange. I have a record value in the database which MySQL shows being zero, while the Django ORM retrieves it as None
. Check out:
mysql> select * from mytable;
+----+--------+------------+-----------------+
| id | number | start_date | expiration_date |
+----+--------+------------+-----------------+
| 1 | 0 | 2019-08-08 | 2020-01-15 |
+----+--------+------------+-----------------+
1 row in set (0.00 sec)
The column number
is clearly zero, but Django's shell says...
In [3]: record = models.MyTable.objects.get(id=1)
In [4]: record.number is None
Out[4]: True
The field definition is a simple:
number = models.IntegerField()
The same code running in my local machine shows record.value == 0
. I've checked that Django, mysql-connector-python and MySQL are all the same version as in my local machine, same table definition, no migrations pending.
Any ideas?
Thanks in advance!