

def db_type(self, field):
    '\n        Provides a choice to continue using db.Key just for primary key\n        storage or to use it for all references (ForeignKeys and other\n        relations).\n\n        We also force the "string" db_type (plain string storage) if a\n        field is to be indexed, and the "text" db_type (db.Text) if\n        it\'s registered as unindexed.\n        '
    if self.connection.settings_dict.get('STORE_RELATIONS_AS_DB_KEYS'):
        if (field.primary_key or (field.rel is not None)):
            return 'key'
    else:
        if field.primary_key:
            return 'key'
        if (field.rel is not None):
            related_field = field.rel.get_related_field()
            if (related_field.get_internal_type() == 'AutoField'):
                return 'integer'
            else:
                return related_field.db_type(connection=self.connection)
    db_type = field.db_type(connection=self.connection)
    if (db_type in ('string', 'text')):
        indexes = get_model_indexes(field.model)
        if (field.attname in indexes['indexed']):
            return 'string'
        elif (field.attname in indexes['unindexed']):
            return 'text'
    return db_type

dataset/ETHPy150Open django-nonrel/djangoappengine/djangoappengine/db/creation.py DatabaseCreation.db_type/original