Created
March 5, 2016 18:06
-
-
Save amitu/59bbd6ae414bfe20ce0b to your computer and use it in GitHub Desktop.
CICharField
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CICharField(models.CharField): | |
def db_type(self, connection): | |
assert connection | |
return 'CITEXT' | |
def from_db_value(self, value, expression, connection, context): | |
if value and isinstance(value, str): | |
value = value.decode("utf-8") | |
return value | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment