diff --git a/sapling/maps/widgets.py b/sapling/maps/widgets.py index 298ac29ad..ee1163cb8 100644 --- a/sapling/maps/widgets.py +++ b/sapling/maps/widgets.py @@ -2,8 +2,6 @@ # This is a thin wrapper over olwidget. # We provide our own media. ################################################ -from urlparse import urljoin - from django.conf import settings from olwidget import widgets @@ -27,8 +25,9 @@ class InfoMap(MediaMixin, widgets.InfoMap): def __init__(self, *args, **kwargs): val = super(InfoMap, self).__init__(*args, **kwargs) - # Just display one layer for InfoMaps, for now. - if len(self.options['layers']) > 1: - self.options['layers'] = self.options['layers'][:1] + # Potentially limit # of layers on InfoMaps, for now. This helps + # with quicker load times on most pages. + max_layers = getattr(settings, 'OLWIDGET_INFOMAP_MAX_LAYERS', 1) + self.options['layers'] = self.options['layers'][:max_layers] return val diff --git a/sapling/settings.py b/sapling/settings.py index 2004e6b78..a877eba39 100644 --- a/sapling/settings.py +++ b/sapling/settings.py @@ -126,6 +126,10 @@ # django-guardian setting ANONYMOUS_USER_ID = -1 +# By default we load only one map layer on most pages to speed up load +# times. +OLWIDGET_INFOMAP_MAX_LAYERS = 1 + # Should we display user's IP addresses to non-admin users? SHOW_IP_ADDRESSES = True