diff --git a/g3w-admin/core/api/base/vector.py b/g3w-admin/core/api/base/vector.py index 079c36959..a7365d15d 100644 --- a/g3w-admin/core/api/base/vector.py +++ b/g3w-admin/core/api/base/vector.py @@ -2,6 +2,7 @@ import deprecation from qgis.core import QgsWkbTypes +from core.utils.qgisapi import get_layer_fids_from_server_fids class MetadataVectorLayer(object): """ @@ -33,5 +34,5 @@ def get_feature(self, pk): """ Returns a (possibly invalid) single feature from QGIS layer """ - - return self.qgis_layer.getFeature(int(pk)) + pk = get_layer_fids_from_server_fids([str(pk)], self.qgis_layer)[0] + return self.qgis_layer.getFeature(pk) diff --git a/g3w-admin/core/utils/structure.py b/g3w-admin/core/utils/structure.py index f4505a663..b8feb6f96 100644 --- a/g3w-admin/core/utils/structure.py +++ b/g3w-admin/core/utils/structure.py @@ -247,6 +247,7 @@ def mapLayerAttributesFromQgisLayer(qgis_layer, **kwargs): field.constraints().constraintStrength( QgsFieldConstraints.ConstraintExpression) == QgsFieldConstraints.ConstraintStrengthHard default_clause = data_provider.defaultValueClause(field_index) + default_clause = default_clause if default_clause != 'nextval(NULL)' else '' # default value for editing from qgis_layer if 'default' not in kwargs: