Skip to content

Commit

Permalink
Add delete draft message
Browse files Browse the repository at this point in the history
  • Loading branch information
Tammo-Feldmann committed Nov 14, 2023
1 parent 4e8870f commit 8e82c7f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/admin_ui/views/v2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Dict

from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.utils.decorators import method_decorator
from django.views.generic.detail import DetailView
from django.forms import modelform_factory
Expand Down Expand Up @@ -151,6 +152,17 @@ class ChangeHistoryList(SingleTableView):
pk_url_kwarg = 'canonical_uuid'
template_name = "api_app/canonical/change_history.html"

def get(self, request, *args, **kwargs):
messages.error(
self.request,
(
f"""The published version of this {self.kwargs['model']} has been deleted and is no longer viewable on
the CASEI UI. You can only view the past version in the {self.kwargs['model']} history."""
),
)

return super().get(request, *args, **kwargs)

def get_queryset(self):
return Change.objects.related_drafts(self.kwargs[self.pk_url_kwarg]).order_by("-updated_at")

Expand Down

0 comments on commit 8e82c7f

Please sign in to comment.