def db_type(self, field):
        if self.connection.settings_dict.get('STORE_RELATIONS_AS_DB_KEYS'):
            if field.primary_key or field.rel is not None:
                return 'key'

        # Primary keys were processed as db.Keys; for related fields
        # the db_type of primary key of the referenced model was used,
        # but RelatedAutoField type was not defined and resulted in
        # "integer" being used for relations to models with AutoFields.
        # TODO: Check with Positive/SmallIntegerField primary keys.
        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)

        # Override db_type of "string" fields according to indexing.
        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
Provides a choice to continue using db.Key just for primary key
dataset/ETHPy150Open django-nonrel/djangoappengine/djangoappengine/db/creation.py/DatabaseCreation.db_type