Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0be75749b8 | |||
| 717cb9e99c | |||
| c87e4e0873 | |||
| d0d89a0053 |
@@ -39,6 +39,9 @@ class ExternalIdentifierAdmin(admin.ModelAdmin):
|
|||||||
"external_id",
|
"external_id",
|
||||||
"internal_id",
|
"internal_id",
|
||||||
]
|
]
|
||||||
|
readonly_fields = [
|
||||||
|
"created",
|
||||||
|
]
|
||||||
|
|
||||||
admin.site.register(APIUserToken, APITokenAdmin)
|
admin.site.register(APIUserToken, APITokenAdmin)
|
||||||
admin.site.register(OAuthToken, OAuthTokenAdmin)
|
admin.site.register(OAuthToken, OAuthTokenAdmin)
|
||||||
|
|||||||
@@ -277,10 +277,10 @@ class GeoJsonValidator:
|
|||||||
"""
|
"""
|
||||||
features = self._input_geojson.get("features", [])
|
features = self._input_geojson.get("features", [])
|
||||||
|
|
||||||
is_input_geojson_empty = len(self._input_geojson) == 0
|
is_input_geojson_empty_str = len(self._input_geojson) == 0
|
||||||
no_features_in_input_found = len(features) == 0
|
no_features_in_input_found = len(features) == 0
|
||||||
|
|
||||||
if not is_input_geojson_empty and no_features_in_input_found:
|
if not is_input_geojson_empty_str and no_features_in_input_found:
|
||||||
# check if _input_geojson is a feature itself
|
# check if _input_geojson is a feature itself
|
||||||
if self.__is_geojson_feature():
|
if self.__is_geojson_feature():
|
||||||
features = [
|
features = [
|
||||||
@@ -288,6 +288,9 @@ class GeoJsonValidator:
|
|||||||
"geometry": self._input_geojson
|
"geometry": self._input_geojson
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
elif self.__is_geojson_featurecollection():
|
||||||
|
# special case if empty featurecollection received
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
self.__add_error("Input does not seem to be geojson")
|
self.__add_error("Input does not seem to be geojson")
|
||||||
return
|
return
|
||||||
@@ -372,3 +375,13 @@ class GeoJsonValidator:
|
|||||||
has_coordinates = self._input_geojson.get("coordinates", None) is not None
|
has_coordinates = self._input_geojson.get("coordinates", None) is not None
|
||||||
has_properties = self._input_geojson.get("properties", None) is not None
|
has_properties = self._input_geojson.get("properties", None) is not None
|
||||||
return has_type and has_coordinates and has_properties
|
return has_type and has_coordinates and has_properties
|
||||||
|
|
||||||
|
def __is_geojson_featurecollection(self):
|
||||||
|
""" Checks whether _input_geojson is a geojson featurecollection
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
"""
|
||||||
|
is_fc_type = self._input_geojson.get("type", None) == "FeatureCollection"
|
||||||
|
has_feature_attribute = isinstance(self._input_geojson.get("features", None), list)
|
||||||
|
return is_fc_type and has_feature_attribute
|
||||||
Reference in New Issue
Block a user