#7190: BooleanField does not return <type: 'bool'> -------------------------------------+------------------------------------- Reporter: Jeffrey Froman | Owner: nobody Type: Uncategorized | Status: closed Component: Database layer | Version: master (models, ORM) | Resolution: fixed Severity: Normal | Triage Stage: Accepted Keywords: BooleanField, type | Needs documentation: 1 Has patch: 1 | Patch needs improvement: 0 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+------------------------------------- Changes (by ramiro):
* status: reopened => closed * resolution: => fixed Comment: Replying to [comment:12 kirkm@…]: > MySQL 5.0.3 changed bit fields from being tinyints to being some other thing (see: http://dev.mysql.com/doc/refman/5.0/en/bit-field- literals.html). Django now sees them as hex strings like '\x01' for b'1'. As a result, BooleanFields in models no longer work as expected. Setting a single-bit BooleanField using True and False in django works (the database gets '\x01' and '\x00' respectively), but reading these back does not get you a Python bool, but rather the raw string, like '\x00'. I think we need to tweak the Django code again to handle this case. Hmm this would mean the tests added in r1290 when fixing #7190: https://github.com/django/django/blob/stable/1.4.x/tests/regressiontests/model_fields/tests.py#L178 should fail when run against MySQL >= 5.0.3 which I don't think is the case. We will need more information about the exact conditions under which you are seeing this. Bonus points if you can express them in a test case. But please open another ticket instead of reopening this one. -- Ticket URL: <https://code.djangoproject.com/ticket/7190#comment:13> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.