id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 553,Adding fields is non-trivial due to lack of database data type generic mapping,wojtek3@…,Adrian Holovaty,"I added a field named GenericImageField inheriting from field.ImageField and here is the error I got when trying to install the app which has a model using that field: {{{ File ""d:\django\django\core\management.py"", line 209, in get_sql_all return get_sql_create(mod) + get_sql_initial_data(mod) File ""d:\django\django\core\management.py"", line 68, in get_sql_create col_type = db.DATA_TYPES[data_type] KeyError: 'GenericImageField' }}} So in order for this to work I would have to modify db.DATA_TYPES for the chosen DB. This is very non-nice. A suggested and simple solution is adding a function to the Field class which would return the 'internal data type': {{{ class Field: def internal_data_type(self): return self.__class__.__name__ }}} so that one could override it in the new field and set it to return the superclasses name as the internal data type. This would also let you narrow the amount of data types. Perhaps using .__class__.__name__ to find out the data type should be skipped alltogether and an array of standard database-independent data types should be introduced. Those datatypes could be then associated to database-dependent data types in the database driver. java.sql is a good example here, and using class names as names for those 'generic data types' as it is done now is not very nice. ",defect,closed,Core (Other),,normal,fixed,,wojtek3@…,Unreviewed,0,0,0,0,0,0