diff options
author | Tim Graham <timograham@gmail.com> | 2016-12-23 12:46:01 -0500 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2016-12-23 15:06:03 -0500 |
commit | 1a96b54ef6effe902732644ead6e8be55ec8bca4 (patch) | |
tree | 2c9e96704044d3140fa0e88d52270ef89e9976c3 | |
parent | edb961329d73b81e6a2e3795439141d30076271b (diff) | |
download | django-15667.tar.gz |
Updated GIS widgets15667
-rw-r--r-- | django/contrib/gis/admin/options.py | 2 | ||||
-rw-r--r-- | django/contrib/gis/admin/widgets.py | 5 | ||||
-rw-r--r-- | django/contrib/gis/forms/widgets.py | 5 |
3 files changed, 5 insertions, 7 deletions
diff --git a/django/contrib/gis/admin/options.py b/django/contrib/gis/admin/options.py index 4b99ddf354..4ae61661d3 100644 --- a/django/contrib/gis/admin/options.py +++ b/django/contrib/gis/admin/options.py @@ -80,7 +80,7 @@ class GeoModelAdmin(ModelAdmin): collection_type = 'None' class OLMap(self.widget): - template = self.map_template + template_name = self.map_template geom_type = db_field.geom_type wms_options = '' diff --git a/django/contrib/gis/admin/widgets.py b/django/contrib/gis/admin/widgets.py index dc556ba964..014b3ad818 100644 --- a/django/contrib/gis/admin/widgets.py +++ b/django/contrib/gis/admin/widgets.py @@ -3,7 +3,6 @@ import logging from django.contrib.gis.gdal import GDALException from django.contrib.gis.geos import GEOSException, GEOSGeometry from django.forms.widgets import Textarea -from django.template import loader from django.utils import six, translation # Creating a template context that contains Django settings @@ -16,7 +15,7 @@ class OpenLayersWidget(Textarea): """ Renders an OpenLayers map using the WKT of the geometry. """ - def render(self, name, value, attrs=None, renderer=None): + def get_context(self, name, value, attrs=None): # Update the template parameters with any attributes passed in. if attrs: self.params.update(attrs) @@ -77,7 +76,7 @@ class OpenLayersWidget(Textarea): self.params['wkt'] = wkt self.params.update(geo_context) - return loader.render_to_string(self.template, self.params) + return self.params def map_options(self): "Builds the map options hash for the OpenLayers template." diff --git a/django/contrib/gis/forms/widgets.py b/django/contrib/gis/forms/widgets.py index c1995266bb..37e58d9b74 100644 --- a/django/contrib/gis/forms/widgets.py +++ b/django/contrib/gis/forms/widgets.py @@ -6,7 +6,6 @@ from django.conf import settings from django.contrib.gis import gdal from django.contrib.gis.geos import GEOSException, GEOSGeometry from django.forms.widgets import Widget -from django.template import loader from django.utils import six, translation logger = logging.getLogger('django.contrib.gis') @@ -43,7 +42,7 @@ class BaseGeometryWidget(Widget): logger.error("Error creating geometry from value '%s' (%s)", value, err) return None - def render(self, name, value, attrs=None, renderer=None): + def get_context(self, name, value, attrs=None): # If a string reaches here (via a validation error on another # field) then just reconstruct the Geometry. if value and isinstance(value, six.string_types): @@ -74,7 +73,7 @@ class BaseGeometryWidget(Widget): LANGUAGE_BIDI=translation.get_language_bidi(), **attrs )) - return loader.render_to_string(self.template_name, context) + return context class OpenLayersWidget(BaseGeometryWidget): |