Skip to content

Commit

Permalink
Update published delete redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Tammo-Feldmann committed Oct 19, 2023
1 parent ffe621d commit b57517c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 7 additions & 1 deletion app/admin_ui/views/published.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,11 @@ def dispatch(self, *args, **kwargs):
)
change_object.save()
return redirect(
reverse("change-list", kwargs={'model': self._model_config['singular_snake_case']})
reverse(
"canonical-draft-edit",
kwargs={
'model': self._model_config['singular_snake_case'],
'canonical_uuid': kwargs["canonical_uuid"],
},
)
)
12 changes: 7 additions & 5 deletions app/admin_ui/views/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,18 @@ def get_queryset(self):
return Change.objects.all()

def get(self, request, *args, **kwargs):
messages.add_message(
request,
messages.WARNING,
"Deletion in progress. Only after admin approval will the published version be removed.",
)
self.object = self.get_object()
in_progress_drafts = Change.objects.related_in_progress_drafts(
self.kwargs["canonical_uuid"]
)

# Show a warning message if this is a delete draft that is staged for publication
if in_progress_drafts.filter(action=Change.Actions.DELETE).exists():
messages.add_message(
request,
messages.WARNING,
"Deletion in progress. Only after admin approval will the published version be removed.",
)
published_drafts = Change.objects.related_drafts(self.kwargs["canonical_uuid"]).filter(
status=Change.Statuses.PUBLISHED
)
Expand Down

0 comments on commit b57517c

Please sign in to comment.