def get_context(self, name, value, attrs=None, extra_context={}):
        # If a string reaches here (via a validation error on another
        # field) then just reconstruct the Geometry.
        if isinstance(value, six.text_type):
            try:
                value = geos.GEOSGeometry(value)
            except (geos.GEOSException, __HOLE__):
                value = None

        if (
            value and value.geom_type.upper() != self.geom_type and
            self.geom_type != 'GEOMETRY'
        ):
            value = None

        # Defaulting the WKT value to a blank string
        wkt = ''
        if value:
            srid = self.map_srid
            if value.srid != srid:
                try:
                    ogr = value.ogr
                    ogr.transform(srid)
                    wkt = ogr.wkt
                except gdal.OGRException:
                    pass  # wkt left as an empty string
            else:
                wkt = value.wkt
        context = super(BaseGeometryWidget, self).get_context(name, wkt, attrs)
        context['module'] = 'map_%s' % name.replace('-', '_')
        context['name'] = name

        # Deprecated, we will remove this in a future release, it's no longer
        # used. But we keep it here for now as it's documented in
        # docs/geodjango.rst

        # Django >= 1.4 doesn't have ADMIN_MEDIA_PREFIX anymore, we must
        # rely on contrib.staticfiles.
        if hasattr(settings, 'ADMIN_MEDIA_PREFIX'):
            context['ADMIN_MEDIA_PREFIX'] = settings.ADMIN_MEDIA_PREFIX
        else:
            context['ADMIN_MEDIA_PREFIX'] = settings.STATIC_URL + 'admin/'
        context['LANGUAGE_BIDI'] = translation.get_language_bidi()
        return context
dataset/ETHPy150Open gregmuellegger/django-floppyforms/floppyforms/gis/widgets.py/BaseGeometryWidget.get_context