Skip to content

Commit

Permalink
dont create layer everytime we need the id
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Oct 19, 2023
1 parent 6993a65 commit 4380aec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions modelbaker/dataobjects/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
Qgis,
QgsCoordinateReferenceSystem,
QgsDataSourceUri,
QgsExpressionContextUtils,
QgsLayerDefinition,
QgsRasterLayer,
QgsRectangle,
Expand Down
4 changes: 2 additions & 2 deletions modelbaker/dataobjects/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def create(

minimal_selection = cardinality.startswith("1")

current_layer = layer_obj.create()
current_layer = layer_obj.create(self.optimize_strategy)

field_widget = "ValueRelation"
field_widget_config = {
Expand All @@ -234,7 +234,7 @@ def create(
"Value": value_field,
"OrderByValue": False,
"AllowNull": True,
"Layer": domain_table.create().id(),
"Layer": domain_table.real_id,
"FilterExpression": "",
"Key": key_field,
"NofColumns": 1,
Expand Down
4 changes: 2 additions & 2 deletions modelbaker/dataobjects/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def create(self, qgis_project, relations):

relation.setId(self._id)
relation.setName(self.name)
relation.setReferencingLayer(self.referencing_layer.create().id())
relation.setReferencedLayer(self.referenced_layer.create().id())
relation.setReferencingLayer(self.referencing_layer.real_id)
relation.setReferencedLayer(self.referenced_layer.real_id)
relation.addFieldPair(self.referencing_field, self.referenced_field)
relation.setStrength(self.strength)
self.qgis_relation = relation
Expand Down

0 comments on commit 4380aec

Please sign in to comment.