Merge pull request 'Fix geometry conflict message' (#211) from hotfix_geom_conflict_msg_with_deleted_entry into master

Reviewed-on: SGD-Nord/konova#211
This commit is contained in:
mpeltriaux 2022-09-29 10:30:06 +02:00
commit 49f57a4bf6

View File

@ -698,18 +698,16 @@ class GeoReferencedMixin(models.Model):
return request return request
instance_objs = [] instance_objs = []
add_message = False
conflicts = self.geometry.conflicts_geometries.all() conflicts = self.geometry.conflicts_geometries.all()
for conflict in conflicts: for conflict in conflicts:
instance_objs += conflict.affected_geometry.get_data_objects() instance_objs += conflict.affected_geometry.get_data_objects()
add_message = True
conflicts = self.geometry.conflicted_by_geometries.all() conflicts = self.geometry.conflicted_by_geometries.all()
for conflict in conflicts: for conflict in conflicts:
instance_objs += conflict.conflicting_geometry.get_data_objects() instance_objs += conflict.conflicting_geometry.get_data_objects()
add_message = True
add_message = len(instance_objs) > 0
if add_message: if add_message:
instance_identifiers = [x.identifier for x in instance_objs] instance_identifiers = [x.identifier for x in instance_objs]
instance_identifiers = ", ".join(instance_identifiers) instance_identifiers = ", ".join(instance_identifiers)