From fd3b51d8eeca1fc11e7ba48572fb476e605a7f9c Mon Sep 17 00:00:00 2001 From: Etienne Trimaille Date: Mon, 6 Nov 2023 17:38:03 +0100 Subject: [PATCH] Follow up previous commit about non existing PK --- lizmap/project_checker_tools.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lizmap/project_checker_tools.py b/lizmap/project_checker_tools.py index dc72b8a8..cc0df2db 100644 --- a/lizmap/project_checker_tools.py +++ b/lizmap/project_checker_tools.py @@ -65,13 +65,12 @@ def invalid_int8_primary_key(layer: QgsVectorLayer) -> bool: if not primary_key: return False - field = layer.fields().field(primary_key) - - if not field: + if primary_key not in layer.fields().names(): # The primary key used in the datasource doesn't exist in the proper layer fields # We don't check, because this test is done in "auto_generated_primary_key_field" return False + field = layer.fields().field(primary_key) return field.typeName().lower() == 'int8'