Opened 11 years ago
Closed 11 years ago
#21606 closed Bug (fixed)
OSMWidget overrides map position passed to widget constructor
Reported by: | jgoclawski | Owned by: | jgoclawski |
---|---|---|---|
Component: | GIS | Version: | 1.6 |
Severity: | Normal | Keywords: | gis, osmwidget |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When you pass default_lon
or default_lat
in attrs
dictionary to OSMWidget
constructor, it doesn't work as expected. Passed values are overriden by those fixed in the OSMWidget
class.
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.
Change History (6)
comment:1 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 11 years ago
Has patch: | set |
---|
comment:4 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:5 by , 11 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Just waiting an answer about the commit https://github.com/jgoclawski/django/commit/cc3ddbf9718d
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Link to the Github branch with a fix for this issue: https://github.com/jgoclawski/django/commits/ticket_21606