Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
0d565dac
Commit
0d565dac
authored
Dec 07, 2014
by
Alex Kerney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the DEFAULT_FORMATTERS to WKBElement instead of Shapely
parent
bf33c0ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
typefmt.py
flask_admin/contrib/geoa/typefmt.py
+5
-4
No files found.
flask_admin/contrib/geoa/typefmt.py
View file @
0d565dac
...
...
@@ -3,7 +3,8 @@ import json
from
jinja2
import
Markup
from
wtforms.widgets
import
html_params
from
shapely.geometry
import
mapping
from
shapely.geometry.base
import
BaseGeometry
from
geoalchemy2.shape
import
to_shape
from
geoalchemy2.elements
import
WKBElement
def
geom_formatter
(
view
,
value
):
...
...
@@ -12,12 +13,12 @@ def geom_formatter(view, value):
"disabled"
:
"disabled"
,
"data-width"
:
100
,
"data-height"
:
70
,
"data-geometry-type"
:
value
.
geom_type
,
"data-geometry-type"
:
to_shape
(
value
)
.
geom_type
,
"data-zoom"
:
15
,
})
geojson
=
json
.
dumps
(
mapping
(
value
))
geojson
=
json
.
dumps
(
mapping
(
to_shape
(
value
)
))
return
Markup
(
'<textarea
%
s>
%
s</textarea>'
%
(
params
,
geojson
))
DEFAULT_FORMATTERS
=
BASE_FORMATTERS
.
copy
()
DEFAULT_FORMATTERS
[
BaseGeometry
]
=
geom_formatter
DEFAULT_FORMATTERS
[
WKBElement
]
=
geom_formatter
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment