diff --git a/g3w-admin/core/utils/structure.py b/g3w-admin/core/utils/structure.py index 2d96b0eef..ee6f2c5d0 100644 --- a/g3w-admin/core/utils/structure.py +++ b/g3w-admin/core/utils/structure.py @@ -141,7 +141,7 @@ def editingFormField(fieldName, type=FIELD_TYPE_STRING, editable=True, required= def mapLayerAttributes(layer, formField=False, **kwargs): """ - Map database columns data from layer by type for client editing + Map database columns data from layer by type for client """ mappingData = FIELD_TYPES_MAPPING diff --git a/g3w-admin/editing/tests/data/api/editing_api_config_cities_54d40b01_2af8_4b17_8495_c5833485536e.json b/g3w-admin/editing/tests/data/api/editing_api_config_cities_54d40b01_2af8_4b17_8495_c5833485536e.json index 3fc05eec1..ee0ee4bd3 100644 --- a/g3w-admin/editing/tests/data/api/editing_api_config_cities_54d40b01_2af8_4b17_8495_c5833485536e.json +++ b/g3w-admin/editing/tests/data/api/editing_api_config_cities_54d40b01_2af8_4b17_8495_c5833485536e.json @@ -1,431 +1,324 @@ { - "result":true, - "vector":{ - "format":"GeoJSON", - "count":null, - "data":null, - "geometrytype":"Point", - "fields":[ - { - "name":"ogc_fid", - "type":"bigint", - "label":"ogc_fid", - "editable":false, - "validate":{ - "required":true, - "unique":true - }, - "pk":true, - "default":"Autogenerate", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"geonameid", - "type":"bigint", - "label":"geonameid", - "editable":true, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"name", - "type":"varchar", - "label":"name", - "editable":true, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"asciiname", - "type":"varchar", - "label":"asciiname", - "editable":true, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"iso2_code", - "type":"varchar", - "label":"iso2_code", - "editable":true, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"population", - "type":"bigint", - "label":"population", - "editable":true, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"gtopo30", - "type":"bigint", - "label":"gtopo30", - "editable":true, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_ogc_fid", - "type":"bigint", - "label":"countries_ogc_fid", - "editable":false, - "validate":{ - "required":true, - "unique":true - }, - "pk":"", - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_name_local", - "type":"varchar", - "label":"countries_name_local", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_name_en", - "type":"varchar", - "label":"countries_name_en", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_capital_en", - "type":"varchar", - "label":"countries_capital_en", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_name_de", - "type":"varchar", - "label":"countries_name_de", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_capital_de", - "type":"varchar", - "label":"countries_capital_de", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_name_it", - "type":"varchar", - "label":"countries_name_it", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_capital_it", - "type":"varchar", - "label":"countries_capital_it", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_name_fr", - "type":"varchar", - "label":"countries_name_fr", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_capital_fr", - "type":"varchar", - "label":"countries_capital_fr", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_name_br", - "type":"varchar", - "label":"countries_name_br", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_capital_br", - "type":"varchar", - "label":"countries_capital_br", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_name_es", - "type":"varchar", - "label":"countries_name_es", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_capital_es", - "type":"varchar", - "label":"countries_capital_es", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_population", - "type":"bigint", - "label":"countries_population", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_area_km2", - "type":"bigint", - "label":"countries_area_km2", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - }, - { - "name":"countries_iso_num", - "type":"bigint", - "label":"countries_iso_num", - "editable":false, - "validate":{ - - }, - "pk":false, - "default":"", - "input":{ - "type":"text", - "options":{ - - } - } - } - ] - }, - "featurelocks":null, - "constraints":{ - - }, - "capabilities": [ - "add_feature", - "change_feature", - "delete_feature", - "change_attr_feature" - ] + "result": true, + "vector": { + "format": "GeoJSON", + "count": null, + "data": null, + "geometrytype": "Point", + "fields": [{ + "name": "ogc_fid", + "type": "bigint", + "label": "ogc_fid", + "editable": false, + "validate": { + "required": true, + "unique": true + }, + "pk": true, + "default": "Autogenerate", + "input": { + "type": "text", + "options": {} + } + }, { + "name": "geonameid", + "type": "bigint", + "label": "geonameid", + "editable": true, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + } + }, { + "name": "name", + "type": "varchar", + "label": "name", + "editable": true, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + } + }, { + "name": "asciiname", + "type": "varchar", + "label": "asciiname", + "editable": true, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + } + }, { + "name": "iso2_code", + "type": "varchar", + "label": "iso2_code", + "editable": true, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + } + }, { + "name": "population", + "type": "bigint", + "label": "population", + "editable": true, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + } + }, { + "name": "gtopo30", + "type": "bigint", + "label": "gtopo30", + "editable": true, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + } + }, { + "name": "countries_ogc_fid", + "type": "bigint", + "label": "countries_ogc_fid", + "editable": false, + "validate": { + "required": true, + "unique": true + }, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_name_local", + "type": "varchar", + "label": "countries_name_local", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_name_en", + "type": "varchar", + "label": "countries_name_en", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_capital_en", + "type": "varchar", + "label": "countries_capital_en", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_name_de", + "type": "varchar", + "label": "countries_name_de", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_capital_de", + "type": "varchar", + "label": "countries_capital_de", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_name_it", + "type": "varchar", + "label": "countries_name_it", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_capital_it", + "type": "varchar", + "label": "countries_capital_it", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_name_fr", + "type": "varchar", + "label": "countries_name_fr", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_capital_fr", + "type": "varchar", + "label": "countries_capital_fr", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_name_br", + "type": "varchar", + "label": "countries_name_br", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_capital_br", + "type": "varchar", + "label": "countries_capital_br", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_name_es", + "type": "varchar", + "label": "countries_name_es", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_capital_es", + "type": "varchar", + "label": "countries_capital_es", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_population", + "type": "bigint", + "label": "countries_population", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_area_km2", + "type": "bigint", + "label": "countries_area_km2", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }, { + "name": "countries_iso_num", + "type": "bigint", + "label": "countries_iso_num", + "editable": false, + "validate": {}, + "pk": false, + "default": "", + "input": { + "type": "text", + "options": {} + }, + "vectorjoin_id": "cities_54d40b01_2af8_4b17_8495_c5833485536e_vectorjoin_0" + }] + }, + "featurelocks": null, + "constraints": {}, + "capabilities": ["add_feature", "change_feature", "delete_feature", "change_attr_feature"] } \ No newline at end of file diff --git a/g3w-admin/editing/tests/data/logging_test.db b/g3w-admin/editing/tests/data/logging_test.db index b5c75561c..08ea2f2dd 100644 Binary files a/g3w-admin/editing/tests/data/logging_test.db and b/g3w-admin/editing/tests/data/logging_test.db differ diff --git a/g3w-admin/editing/tests/test_api.py b/g3w-admin/editing/tests/test_api.py index 0d708b1c1..fced001ef 100644 --- a/g3w-admin/editing/tests/test_api.py +++ b/g3w-admin/editing/tests/test_api.py @@ -176,6 +176,7 @@ def test_editing_api(self): # In more recent QGIS versions ogc_fid will have a required constraint try: + self.assertEqual(json.loads(response.content), res_expected) except AssertionError: actual = json.loads(response.content)