I have a MapModelForm, but it doesn't seem to be responding to options in Meta (Django 1.3 beta 1, olwidget 0.4):
class SiteForm(MapModelForm):
class Meta:
model = Site
exclude = ('next', 'prev', 'centroid',) # for now, don't want people br
options = {
'layers': ['google.satellite', 'google.streets', 'google.physical',
'google.hybrid', 'osm.mapnik', 've.road', 've.shaded',
've.aerial', 've.hybrid',],
'default_lat': 45,
'default_lon': -87,
'map_div_style': {'width': '900px', 'height': '640px'},
'map_options': {
'controls': ['LayerSwitcher', 'Navigation', 'PanZoom', 'Attribut
'ScaleLine'],
}
}
centroid isn't a field I'm interested in, the other geometry field is being edited by olwidget on the form, works fine, but it's just the default map with OpenStreetMap, and for this app. photography would make a much better background. Anything obviously wrong?
I have the google API key in settings, and all these layers working in a vanilla OpenLayers map in the same app.
It looks like form.media isn't writing as much as I'd expect into the page, but then I'm not sure what it is supposed to write - should there be script links to google API etc? Also firebug isn't catching any errors.
Thanks,
Terry
Can you send the html/javascript that is output by {{ form.media }} and
{{ form }}?
What you should see is the google API links and such output by
form.media and the map constructor with options from {{ form }}.
I also haven't done much testing with 1.3 alpha; I've been tracking 1.2,
but I don't know of any reasons why things shouldn't work there.
best,
Charlie
> hmm, so it's like the options aren't getting through from Meta. I'll try and run it on 1.2
Same result in 1.2.4, looked at my code again and it's definitely using the class SiteForm(MapModelForm) as posted... not sure what else could be interfering.
Cheers -Terry
Thanks muchly, it was a total bug; the options dict was indeed not being
read.
I've fixed this with the latest trunk at
https://github.com/yourcelf/olwidget.git , and added a test case for it.
-charlie
> I've fixed this with the latest trunk at
> https://github.com/yourcelf/olwidget.git , and added a test case for it.
Fantastic - thanks - works great now.
Cheers -Terry