'Provides a proper substitution value for Geometries that are not in the
SRID of the field.  Specifically, this routine will substitute in the
Transform() and GeomFromText() function call(s).'

def get_geom_placeholder(self, f, value):

    def transform_value(value, srid):
        return (not ((value is None) or (value.srid == srid)))
    if hasattr(value, 'expression'):
        if transform_value(value, f.srid):
            placeholder = ('%s(%%s,    %s)' % (self.transform, f.srid))
        else:
            placeholder = '%s'
        return ((placeholder % '%s.%s') % tuple(map(self.quote_name, value.cols[value.expression])))
    elif transform_value(value, f.srid):
        return ('%s(%s(%%s,%s),    %s)' % (self.transform, self.from_text, value.srid, f.srid))
    else:
        return ('%s(%%s,%s)' % (self.from_text, f.srid))
