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:
Yohan Boniface 2018-09-08 22:42:11 +02:00
parent 709387d985
commit c5ca7e5d73
2 changed files with 4 additions and 1 deletions

View file

@ -63,7 +63,8 @@ class MapSettingsForm(forms.ModelForm):
def __init__(self, *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):
slug = self.cleaned_data.get('slug', None)

View file

@ -33,6 +33,8 @@ def test_create(client, user, post_data):
created_map = Map.objects.latest('pk')
assert j['id'] == created_map.pk
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):