Skip to content

Commit

Permalink
Fix mixing referencing and referenced fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
wlorenzetti committed Sep 11, 2023
1 parent a5dda64 commit 46d12ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion g3w-admin/core/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,8 @@ def testCoreInterfaceOwsView(self):
self.assertEqual(len(jres['layers']), 21)

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


def test_crs_api_rest(self):
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],
'referencedField': field_refs[1]
'referencingField': fields_referenging,
'referencedField': fields_referenced
}
})

Expand Down

0 comments on commit 46d12ac

Please sign in to comment.