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
eabc326e
Commit
eabc326e
authored
Sep 05, 2016
by
Andrew Grigorev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix geoa.GeoJSONField
parent
22e206c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
fields.py
flask_admin/contrib/geoa/fields.py
+2
-3
test_basic.py
flask_admin/tests/geoa/test_basic.py
+3
-1
No files found.
flask_admin/contrib/geoa/fields.py
View file @
eabc326e
...
@@ -45,20 +45,19 @@ class GeoJSONField(JSONField):
...
@@ -45,20 +45,19 @@ class GeoJSONField(JSONField):
return
self
.
raw_data
[
0
]
return
self
.
raw_data
[
0
]
if
type
(
self
.
data
)
is
geoalchemy2
.
elements
.
WKBElement
:
if
type
(
self
.
data
)
is
geoalchemy2
.
elements
.
WKBElement
:
if
self
.
srid
is
-
1
:
if
self
.
srid
is
-
1
:
self
.
data
=
self
.
session
.
scalar
(
return
self
.
session
.
scalar
(
func
.
ST_AsGeoJson
(
func
.
ST_AsGeoJson
(
self
.
_flip_coordinates
(
self
.
data
)
self
.
_flip_coordinates
(
self
.
data
)
)
)
)
)
else
:
else
:
self
.
data
=
self
.
session
.
scalar
(
return
self
.
session
.
scalar
(
func
.
ST_AsGeoJson
(
func
.
ST_AsGeoJson
(
self
.
_flip_coordinates
(
self
.
_flip_coordinates
(
func
.
ST_Transform
(
self
.
data
,
self
.
web_srid
)
func
.
ST_Transform
(
self
.
data
,
self
.
web_srid
)
)
)
)
)
)
)
return
super
(
GeoJSONField
,
self
)
.
_value
()
def
process_formdata
(
self
,
valuelist
):
def
process_formdata
(
self
,
valuelist
):
super
(
GeoJSONField
,
self
)
.
process_formdata
(
valuelist
)
super
(
GeoJSONField
,
self
)
.
process_formdata
(
valuelist
)
...
...
flask_admin/tests/geoa/test_basic.py
View file @
eabc326e
...
@@ -6,7 +6,7 @@ from flask_admin.contrib.geoa import ModelView
...
@@ -6,7 +6,7 @@ from flask_admin.contrib.geoa import ModelView
from
flask_admin.contrib.geoa.fields
import
GeoJSONField
from
flask_admin.contrib.geoa.fields
import
GeoJSONField
from
geoalchemy2
import
Geometry
from
geoalchemy2
import
Geometry
from
geoalchemy2.shape
import
to_shape
from
geoalchemy2.shape
import
to_shape
from
nose.tools
import
eq_
from
nose.tools
import
eq_
,
ok_
from
.
import
setup
from
.
import
setup
...
@@ -96,6 +96,8 @@ def test_model():
...
@@ -96,6 +96,8 @@ def test_model():
url
=
'/admin/geomodel/edit/?id=
%
s'
%
model
.
id
url
=
'/admin/geomodel/edit/?id=
%
s'
%
model
.
id
rv
=
client
.
get
(
url
)
rv
=
client
.
get
(
url
)
eq_
(
rv
.
status_code
,
200
)
eq_
(
rv
.
status_code
,
200
)
data
=
rv
.
data
.
decode
(
'utf-8'
)
ok_
(
r' name="multi">{"type":"MultiPoint","coordinates":[[100,0],[101,1]]}</textarea>'
in
data
)
# rv = client.post(url, data={
# rv = client.post(url, data={
# "name": "edited",
# "name": "edited",
...
...
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