diff options
-rw-r--r-- | archaeological_operations/tests.py | 4 | ||||
-rw-r--r-- | ishtar_common/models.py | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index bbe92b3c8..9abc62bd4 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -170,6 +170,10 @@ class ImportOperationTest(TestCase): self.assertEqual(models.Parcel.objects.get(parcel_number='55', section='YY').external_id, 'YY55') + # delete associated parcel with the import deletion + parcel_count = models.Parcel.objects.count() + impt.delete() + self.assertEqual(parcel_count-2, models.Parcel.objects.count()) def testParseParcels(self): diff --git a/ishtar_common/models.py b/ishtar_common/models.py index c1ee90df6..a82638396 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1490,9 +1490,6 @@ def pre_delete_import(sender, **kwargs): return to_delete = [] for accessor, imported in instance.get_all_imported(): - # if imported is related to another import do not delete - if getattr(instance, accessor).exclude(pk=imported.pk).count(): - continue to_delete.append(imported) for item in to_delete: item.delete() |