Compare commits

..

5 Commits

Author SHA1 Message Date
mpeltriaux 0be75749b8 Merge pull request '# Bugfix empty feature collection' (#597) from bugfix_empty_geometry_on_form into master
Reviewed-on: #597
2026-10-17 13:04:40 +02:00
mpeltriaux 717cb9e99c # Bugfix empty feature collection
* fixes a bug on empty feature collections input of SimpleGeomForm
2026-10-17 13:03:53 +02:00
mpeltriaux c87e4e0873 Merge pull request '# Bugfix: error on externalIdentifier API' (#595) from fix_externalIdentifier_admin_error into master
Reviewed-on: #595
2026-10-15 11:38:08 +02:00
mpeltriaux d0d89a0053 # Bugfix: error on externalIdentifier API
* fixes bug where an error could occur on the admin view for externalIdentifier
2026-10-15 11:37:20 +02:00
mpeltriaux 0533083b17 Merge pull request 'Oauth update' (#593) from oauth_update into master
Reviewed-on: #593
2026-10-06 11:57:36 +02:00
2 changed files with 19 additions and 3 deletions
+3
View File
@@ -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)
+16 -3
View File
@@ -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
@@ -371,4 +374,14 @@ class GeoJsonValidator:
has_type = self._input_geojson.get("type", None) is not None has_type = self._input_geojson.get("type", None) is not None
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