Just one comma¶
In Django, if you say managed = False in a model’s Meta, you tell
Django not to touch the database table. So: no automatic database migrations,
for instance.
Now, what is the problem if you have managed = False, and Django does
do migrations?
Some of you will have seen the error already.
The comma after False is the problem:
>>> a = False,
>>> a
(False,)
>>> bool(a)
True
The comma turns it into a tuple. And a non-empty tuple evaluates to True!
I found it quite funny. My colleague was torn between “extremely relieved” and “extremely annoyed” :-)