1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Support assignment of secrets to virtual machines

This commit is contained in:
Jeremy Stretch
2020-09-18 15:39:41 -04:00
parent ec095e58b7
commit 43f3e682c5
9 changed files with 109 additions and 64 deletions

View File

@ -82,13 +82,6 @@ class SecretEditView(ObjectEditView):
model_form = forms.SecretForm
template_name = 'secrets/secret_edit.html'
def alter_obj(self, secret, request, args, kwargs):
if not secret.pk:
# Set assigned_object based on URL kwargs
model = kwargs.get('model')
secret.assigned_object = get_object_or_404(model, pk=kwargs['object_id'])
return secret
def dispatch(self, request, *args, **kwargs):
# Check that the user has a valid UserKey