diff --git a/vocabs/templates/vocabs/skosconceptscheme_detail.html b/vocabs/templates/vocabs/skosconceptscheme_detail.html index fbc6b23..7264394 100644 --- a/vocabs/templates/vocabs/skosconceptscheme_detail.html +++ b/vocabs/templates/vocabs/skosconceptscheme_detail.html @@ -287,7 +287,11 @@

{% endfor %} + + {% if user.is_authenticated %} + Remove legacy ids + {% endif %} {% endif %} {% endif %} diff --git a/vocabs/urls.py b/vocabs/urls.py index 13ed9be..09d75f1 100644 --- a/vocabs/urls.py +++ b/vocabs/urls.py @@ -21,6 +21,9 @@ path( 'scheme/update/', views.SkosConceptSchemeUpdate.as_view(), name='skosconceptscheme_update'), + path( + 'scheme/remove-keys/', views.delete_legacy_id_view, + name='skosconceptscheme_remove_keys'), path( 'scheme/delete/', views.SkosConceptSchemeDelete.as_view(), diff --git a/vocabs/views.py b/vocabs/views.py index d19da20..deeccc4 100644 --- a/vocabs/views.py +++ b/vocabs/views.py @@ -1,5 +1,6 @@ import time import datetime +from django.shortcuts import get_object_or_404, redirect from guardian.shortcuts import get_objects_for_user from django.contrib.auth.decorators import login_required from reversion.models import Version @@ -41,6 +42,7 @@ SkosCollectionListFilter ) from vocabs.rdf_utils import graph_construct_qs, RDF_FORMATS +from vocabs.utils import delete_legacy_ids class BaseDetailView(DetailView): @@ -124,6 +126,13 @@ def get_context_data(self, **kwargs): return context +@login_required +def delete_legacy_id_view(request, pk): + obj = get_object_or_404(SkosConceptScheme, pk=pk) + delete_legacy_ids(obj) + return redirect(obj) + + class SkosConceptSchemeCreate(BaseCreateView): model = SkosConceptScheme form_class = SkosConceptSchemeForm