Skip to content

Commit

Permalink
Set 'editable' to False if join field is a Pk.
Browse files Browse the repository at this point in the history
  • Loading branch information
wlorenzetti committed Sep 19, 2023
1 parent 3ef9e70 commit bb9de45
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions g3w-admin/core/utils/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,15 @@ def mapLayerAttributesFromQgisLayer(qgis_layer, **kwargs):
join_fields = {}
for order, join in enumerate(qgis_layer.vectorJoins()):
join_id = f'{qgis_layer.id()}_vectorjoin_{order}'
for f in join.joinLayer().fields():
joinlayer_pk_attributes = join.joinLayer().primaryKeyAttributes()
for i, f in enumerate(join.joinLayer().fields()):
editable = join.isEditable()

# Check if referencing field is PK
if i in joinlayer_pk_attributes:
editable = False
join_fields[join.prefixedFieldName(f)] = {
'editable': join.isEditable(),
'editable': editable,
'join_id': join_id}


Expand Down

0 comments on commit bb9de45

Please sign in to comment.