The defaults are: `default_lon = 5`, `default_lat = 47` and you cannot
change them, unless you create a a new widget class derived from
`OSMWidget`.
Example:
If you want to set e.g. `map_width`, you can do this with the
`BaseGeometryWidget`:
{{{
coordinates = forms.PointField(widget=widgets.BaseGeometryWidget(
attrs={'map_width': 100}
))
}}}
and it is used instead of default '''600''' value declared in
`BaseGeometryWidget`.
But if you wanted to set `OSMWidget`'s default_lon or default_lat, you
would expect this should work:
{{{
coordinates = forms.PointField(widget=widgets.OSMWidget(
attrs={'default_lon': 11,
'default_lat': 12}
))
}}}
Well... it doesn't work. You will get a map rendered with `default_lon =
5`, `default_lat = 47`.
I'm preparing a GitHub pull request solving this issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/21606>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => jgoclawski
* needs_docs: => 0
* status: new => assigned
* needs_tests: => 0
* needs_better_patch: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/21606#comment:1>
* has_patch: 0 => 1
Comment:
Link to the Github branch with a fix for this issue:
https://github.com/jgoclawski/django/commits/ticket_21606
--
Ticket URL: <https://code.djangoproject.com/ticket/21606#comment:2>
Comment (by jgoclawski):
GitHub pull request: https://github.com/django/django/pull/2072
--
Ticket URL: <https://code.djangoproject.com/ticket/21606#comment:3>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/21606#comment:4>
* stage: Accepted => Ready for checkin
Comment:
Just waiting an answer about the commit
https://github.com/jgoclawski/django/commit/cc3ddbf9718d
--
Ticket URL: <https://code.djangoproject.com/ticket/21606#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"2ddf1fc50f8fbb26ce5c6b9115111564bf21248c"]:
{{{
#!CommitTicketReference repository=""
revision="2ddf1fc50f8fbb26ce5c6b9115111564bf21248c"
Fixed #21606 -- Fixed default_lat and default_lon override in OSMWidget
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/21606#comment:6>