I'm trying to implement creating custom geographic object by GeoDjango. In model I have this field.
mpoly = models.MultiPolygonField()
Then I create form
from django.contrib.gis import forms as geoforms
from world.models import Country
class CountryForm(geoforms.ModelForm):
class Meta:
model = Country
widgets = {
'mpoly': geoforms.OSMWidget(attrs={'map_width': 800, 'map_height': 500}),
}
and rendered it by
<head>{{ form.media }}</head>
<body>
<form>
{{form}}
<button class="btn btn-primary" type="submit">Save</button>
</form>
</body>
Full page code is here
After drawing polygon on map I get error in MapWidget.searializeFeatures function.
Uncaught TypeError: a.Y is not a function
at bp (https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.1/ol.js:459:803)
at Zo.k.Te (https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.1/ol.js:464:27)
at Zo.k.od (https://cdnjs.cloudflare.com/ajax/libs/ol3/3.20.1/ol.js:431:47)
at MapWidget.serializeFeatures (http://localhost:8000/gstatic/gis/js/OLMapWidget.js:227:69)
at D.<anonymous> (http://localhost:8000/gstatic/gis/js/OLMapWidget.js:89:22)
at D.b (https://openlayers.org/en/v4.0.1/build/ol.js:41:394)
at Dc.b (https://openlayers.org/en/v4.0.1/build/ol.js:44:213)
at D.k.Be (https://openlayers.org/en/v4.0.1/build/ol.js:47:617)
at D.k.push (https://openlayers.org/en/v4.0.1/build/ol.js:48:41)
at Qt.k.Nd (https://openlayers.org/en/v4.0.1/build/ol.js:634:301)
I can't find anything meaningful about this error.
What is the reason for this error, and how can I fix it?