# Drop atomic transaction

* drops atomic transaction processing on Parcel.make_unique
This commit is contained in:
mpeltriaux 2024-10-26 10:24:10 +02:00
parent f39d99b2fd
commit eb528de48b

View File

@ -159,7 +159,6 @@ class Parcel(UuidModel):
return f"{self.parcel_group} | {self.flr} | {self.flrstck_zhlr} | {self.flrstck_nnr}" return f"{self.parcel_group} | {self.flr} | {self.flrstck_zhlr} | {self.flrstck_nnr}"
@classmethod @classmethod
@transaction.atomic
def make_unique(cls, **kwargs): def make_unique(cls, **kwargs):
""" Checks for duplicates of a Parcel, choose a (now) unique one, """ Checks for duplicates of a Parcel, choose a (now) unique one,
repairs relations for ParcelIntersection and removes duplicates. repairs relations for ParcelIntersection and removes duplicates.
@ -188,6 +187,7 @@ class Parcel(UuidModel):
intersection_objs = ParcelIntersection.objects.filter( intersection_objs = ParcelIntersection.objects.filter(
parcel__in=parcel_objs parcel__in=parcel_objs
) )
# Change each intersection, so they point on the 'true one' parcel from now on # Change each intersection, so they point on the 'true one' parcel from now on
for intersection in intersection_objs: for intersection in intersection_objs:
intersection.parcel = unique_parcel intersection.parcel = unique_parcel