Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeyStk committed Aug 7, 2024
1 parent 8a32685 commit a46cc95
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions integreat_cms/cms/views/regions/region_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from linkcheck.listeners import disable_listeners

from ...decorators import permission_required
from ...models import Page, PushNotification, Region
from ...models import Contact, Page, PushNotification, Region

if TYPE_CHECKING:
from typing import Any
Expand Down Expand Up @@ -51,7 +51,7 @@ def delete_region(
messages.error(
request,
format_html(
"{}<ul class='list-disc pl-4'>{}</ul>",
"{}<ul class='pl-4 list-disc'>{}</ul>",
_(
"Region could not be deleted, because the following pages are mirrored in other regions:"
),
Expand Down Expand Up @@ -96,6 +96,8 @@ def delete_region(
region.events.update(location=None)
# Prevent ProtectedError when media files get deleted before their usages as organization logo
region.organizations.all().delete()
# Prevent ProtectedError when location gets deleted before their contacts
Contact.objects.filter(poi__region=region).delete()
# Prevent IntegrityError when multiple feedback objects exist
region.feedback.all().delete()
# Disable linkchecking while deleting this region
Expand Down

0 comments on commit a46cc95

Please sign in to comment.