Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Relation type many with multifield keys #596

Merged
merged 22 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f4b5efe
Add case "graduatedSymbol" to getlegendgraphic filter.
Aug 30, 2023
a5dda64
Fix relation's fields info for 1:N relation.
Sep 11, 2023
364a42a
Merge branch 'dev' of https://github.com/g3w-suite/g3w-admin into rel…
volterra79 Sep 11, 2023
46d12ac
Fix mixing referencing and referenced fields.
Sep 11, 2023
fd371c5
Merge branch 'relation_many_multifield' of https://github.com/g3w-sui…
volterra79 Sep 11, 2023
8c54088
Add case "graduatedSymbol" to getlegendgraphic filter.
Aug 30, 2023
625fe3b
Merge branch 'dev' into relation_many_multifield
Sep 11, 2023
df0b7af
Fix check is referenced fields ar primary key.
Sep 11, 2023
8505dca
Merge branch 'relation_many_multifield' of https://github.com/g3w-sui…
volterra79 Sep 11, 2023
3544716
Fix test.
Sep 11, 2023
ce53c95
Merge branch 'relation_many_multifield' of https://github.com/g3w-sui…
volterra79 Sep 11, 2023
d98d769
Fix for editing with relations.
Sep 11, 2023
3437097
Merge branch 'relation_many_multifield' of https://github.com/g3w-sui…
volterra79 Sep 11, 2023
0753cbd
:sparkles: Client:
volterra79 Sep 12, 2023
1d8ae3e
:sparkles: Client:
volterra79 Sep 13, 2023
bcf4433
:sparkles: Client:
volterra79 Sep 14, 2023
917fdb8
:sparkles: Client:
volterra79 Sep 15, 2023
cbfeeb8
Give to Editor Level 1 user upload geo-data grant (#594)
wlorenzetti Sep 14, 2023
da42f87
Fix test for external wms service.
Sep 20, 2023
cb2602d
Merge branch 'dev' into relation_many_multifield
wlorenzetti Sep 20, 2023
552a138
Fix test.
Sep 20, 2023
02d9b68
Fix test.
Sep 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion g3w-admin/client/static/client/js/app.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions g3w-admin/core/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,12 +628,12 @@ def testCoreInterfaceOwsView(self):
jres = json.loads(res.content)

self.assertTrue(jres['result'])
self.assertEqual('Geoscopio_wms catasto', jres['title'])
self.assertEqual('Geoscopio_wms catasto'.lower(), jres['title'].lower())
self.assertTrue('image/png' in jres['map_formats'])
self.assertTrue('text/html' in jres['info_formats'])
self.assertEqual(len(jres['layers']), 21)

self.assertEqual(jres['layers'][1]['title'], 'Acque - AdT Catasto Terreni')
self.assertEqual(jres['layers'][1]['title'].lower(), 'Acque - AdT Catasto Terreni'.lower())
self.assertEqual(len(jres['layers'][1]['crss']), 20)


Expand Down
5 changes: 3 additions & 2 deletions g3w-admin/editing/api/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ def save_vector_data(self, metadata_layer, post_layer_data, has_transactions, po
# case relation data ADD, if father referenced field is pk
if is_referenced_field_is_pk:
for newid in kwargs['referenced_layer_insert_ids']:
if geojson_feature['properties'][metadata_layer.referencing_field] == newid['clientid']:
geojson_feature['properties'][metadata_layer.referencing_field] = newid['id']
for referencing_field in metadata_layer.referencing_field:
if geojson_feature['properties'][referencing_field] == newid['clientid']:
geojson_feature['properties'][referencing_field] = newid['id']

if mode_editing == EDITING_POST_DATA_UPDATED:
# control feature locked
Expand Down
2 changes: 1 addition & 1 deletion g3w-admin/editing/static/editing/js/plugin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion g3w-admin/qdjango/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def test_qgis_project(self):

# check layerRelations
# ------------------------------------------
layer_relations_to_check = '[{"referencingLayer": "cities10000eu20171228095720113", "strength": "Association", "referencedLayer": "countries_simpl20171228095706310", "name": "countries-citites", "id": "cities1000_ISO2_CODE_countries__ISOCODE", "fieldRef": {"referencingField": "ISO2_CODE", "referencedField": "ISOCODE"}}]'
layer_relations_to_check = '[{"referencingLayer": "cities10000eu20171228095720113", "strength": "Association", "referencedLayer": "countries_simpl20171228095706310", "name": "countries-citites", "id": "cities1000_ISO2_CODE_countries__ISOCODE", "fieldRef": {"referencingField": ["ISO2_CODE"], "referencedField": ["ISOCODE"]}}]'
self.assertEqual(self.project.layerRelations,
json.loads(layer_relations_to_check))

Expand Down
10 changes: 6 additions & 4 deletions g3w-admin/qdjango/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,13 +1229,15 @@ def _getDataLayerRelations(self):
'referencingLayer': relation.referencingLayerId(),
}
# get only first pair relation
field_refs = []
fields_referenging = []
fields_referenced = []
for referencingField, referencedField in relation.fieldPairs().items():
field_refs.append([referencingField, referencedField])
fields_referenging.append(referencingField)
fields_referenced.append(referencedField)
attrib.update({
'fieldRef': {
'referencingField': field_refs[0][0],
'referencedField': field_refs[0][1]
'referencingField': fields_referenging,
'referencedField': fields_referenced
}
})

Expand Down
2 changes: 1 addition & 1 deletion g3w-admin/qdjango/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def set_metadata_relations(self, request, **kwargs):
# qgis_layer is the referenced layer
qgis_layer = self.layer.qgis_layer
referenced_field_is_pk = [qgis_layer.fields().indexFromName(
relation['fieldRef']['referencedField'])] == qgis_layer.primaryKeyAttributes()
rf) for rf in relation['fieldRef']['referencedField']] == qgis_layer.primaryKeyAttributes()

# It's an old and buggy QGIS version so we cannot trust primaryKeyAttributes() and we go guessing
if IS_QGIS_3_10:
Expand Down
Loading