Closes #6434: Add deprecation warning for stock secrets functionality

This commit is contained in:
jeremystretch 2021-05-20 10:51:41 -04:00
parent 546bbe5418
commit a39522a25e

View File

@ -86,6 +86,18 @@ class SecretRoleBulkDeleteView(generic.BulkDeleteView):
# Secrets
#
def inject_deprecation_warning(request):
"""
Inject a warning message notifying the user of the pending removal of secrets functionality.
"""
messages.warning(
request,
mark_safe('<i class="mdi mdi-alert"></i> The secrets functionality will be moved to a plugin in NetBox v2.12. '
'Please see <a href="https://github.com/netbox-community/netbox/issues/5278">issue #5278</a> for '
'more information.')
)
class SecretListView(generic.ObjectListView):
queryset = Secret.objects.all()
filterset = filtersets.SecretFilterSet
@ -93,10 +105,18 @@ class SecretListView(generic.ObjectListView):
table = tables.SecretTable
action_buttons = ('import', 'export')
def get(self, request):
inject_deprecation_warning(request)
return super().get(request)
class SecretView(generic.ObjectView):
queryset = Secret.objects.all()
def get(self, request, *args, **kwargs):
inject_deprecation_warning(request)
return super().get(request, *args, **kwargs)
class SecretEditView(generic.ObjectEditView):
queryset = Secret.objects.all()