Yohan Boniface committed 9fefcaa

Make DEFAULT_CENTER importable

Comments (0)

Files changed (2)


 from django.contrib.gis.geos import Point
 from django.utils.translation import ugettext as _
 from django.template.defaultfilters import slugify
+from django.conf import settings
 from vectorformats.formats import geojson, kml, gpx
 from .models import Map, Category, Polyline, Polygon, Marker
+DEFAULT_lATITUDE = settings.LEAFLET_LATITUDE if hasattr(settings, "LEAFLET_LATITUDE") else 51
+DEFAULT_LONGITUDE = settings.LEAFLET_LONGITUDE if hasattr(settings, "LEAFLET_LONGITUDE") else 2
 class PlaceholderForm(forms.ModelForm):
     def clean_center(self):
         if not self.cleaned_data['center']:
-            point = Point(2, 51)
+            point = DEFAULT_CENTER
             self.cleaned_data['center'] = point
         return self.cleaned_data['center']


 from django.test import TestCase
-from django.contrib.gis.geos import Point
 from django.contrib.auth.models import User
 from django.utils import simplejson
 from django.core.urlresolvers import reverse
 import factory
 from leaflet_storage.models import Map, TileLayer, Licence, Category, Marker
+from leaflet_storage.forms import DEFAULT_CENTER
 class LicenceFactory(factory.Factory):
     FACTORY_FOR = Map
     name = "test map"
     slug = "test-map"
-    center = Point(2, 51)
+    center = DEFAULT_CENTER
     licence = factory.SubFactory(LicenceFactory)
     owner = factory.SubFactory(UserFactory)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.