1 2 3 4 5 6 7 8 9 10 11 12 13 | class TinyIntegerField(models.SmallIntegerField):
def db_type(self, connection):
if connection.settings_dict['ENGINE'] == 'django.db.backends.mysql':
return "tinyint"
else:
return super(TinyIntegerField, self).db_type(connection)
class PositiveTinyIntegerField(models.PositiveSmallIntegerField):
def db_type(self, connection):
if connection.settings_dict['ENGINE'] == 'django.db.backends.mysql':
return "tinyint unsigned"
else:
return super(PositiveTinyIntegerField, self).db_type(connection)
|
More like this
- ByteSplitterField by Lacour 1 year, 9 months ago
- Generate Model Data. Lots of Options. by bl4th3rsk1t3 3 years, 1 month ago
- Model Choices Helper by pmclanahan 3 years, 3 months ago
- Serializing booleans correctly when doing dumpdata from a MySQL database using Django 0.96 by chrj 4 years, 9 months ago
- HibernateBooleanField by kivsiak 3 years, 4 months ago
Comments