Dear devs,

my situation is as follows:
I am working on some Python code. I have a non-spatial layer in the project created from a PostgreSQL table.
For this layer I can (via Python):
1) create a new feature, manipulate its attribute values and add it to the layer
2) access an existing feature and its attribute values by this code:
feat = QgsFeature()
ok = layer.featureAtId(fid, feat, False, True)
3) open the feature form and have the user manipulate the attribute values of either 1) or 2)

However I could not find a way to access an existing feature and manipulate its attribute values so that the changed values are written back to the layer just like the feature form does. I understand that the feature is not part of the layer as soon as it is accessed by the code given above. Is there a way to replace a feature in a layer or change its attribute values other than via feature form?

To delete the original feature and add a new feature with changed values afterwards is not a solution because there are foreign keys defined on the feature's id. So deletion would not be allowed (foreign-key option RESTRICT) or related datasets in other tables would be deleted, too (foreign-key option CASCADE). So this is not viable.

any hints are welcome

regards

Bernhard



________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to