Change Map.center.widget SRID to 4326 as it should be
By default, a PointField uses a OpenLayersWidget, which forces the SRID to 3857 when casting geojson (no idea why, given geojson SRID is 4326).
This commit is contained in:
parent
709387d985
commit
c5ca7e5d73
2 changed files with 4 additions and 1 deletions
|
@ -63,7 +63,8 @@ class MapSettingsForm(forms.ModelForm):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(MapSettingsForm, self).__init__(*args, **kwargs)
|
super(MapSettingsForm, self).__init__(*args, **kwargs)
|
||||||
self.fields["slug"].required = False
|
self.fields['slug'].required = False
|
||||||
|
self.fields['center'].widget.map_srid = 4326
|
||||||
|
|
||||||
def clean_slug(self):
|
def clean_slug(self):
|
||||||
slug = self.cleaned_data.get('slug', None)
|
slug = self.cleaned_data.get('slug', None)
|
||||||
|
|
|
@ -33,6 +33,8 @@ def test_create(client, user, post_data):
|
||||||
created_map = Map.objects.latest('pk')
|
created_map = Map.objects.latest('pk')
|
||||||
assert j['id'] == created_map.pk
|
assert j['id'] == created_map.pk
|
||||||
assert created_map.name == name
|
assert created_map.name == name
|
||||||
|
assert created_map.center.x == 13.447265624999998
|
||||||
|
assert created_map.center.y == 48.94415123418794
|
||||||
|
|
||||||
|
|
||||||
def test_map_create_permissions(client, settings):
|
def test_map_create_permissions(client, settings):
|
||||||
|
|
Loading…
Reference in a new issue