#20998 closed Cleanup/optimization (fixed)
Form GIS widgets render() lack of modularity
Reported by: | Mathieu Leplatre | Owned by: | nobody |
---|---|---|---|
Component: | GIS | Version: | 1.6-beta-1 |
Severity: | Normal | Keywords: | refactor |
Cc: | Claude Paroz | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When subclassing GIS form widgets, there should be a way to override geometry serialization, without having to duplicate reprojection behaviour.
https://github.com/django/django/blob/1.6b2/django/contrib/gis/forms/widgets.py#L37-L74
I propose to add some additional private methods:
- _deserialize: string (wkt) to geos (geos)
- _transform: from map widget to model projection
- _serialize: geometry to string (wkt)
This would open doors to widgets that support other representation formats (geojson, topojson, ...)
Attachments (1)
Change History (8)
by , 11 years ago
Attachment: | refactor-gis-widgets-WIP.diff added |
---|
comment:1 by , 11 years ago
If the goal is to make the widgets extensible by third-party code, we need a public API rather than a private one.
comment:2 by , 11 years ago
Has patch: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
Many thanks for suggesting those improvements.
As discussed on IRC, my idea is to deprecate most of gis/admin
as soon as the new form fields/widgets in gis/forms.py
proved they can replace former functionality. So I wouldn't touch the gis/admin
part, also for the fact that backwards compatibility is a concern for that code.
comment:3 by , 11 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
Type: | Uncategorized → Cleanup/optimization |
https://github.com/django/django/pull/1532
Please review!
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Draft of modifications intended