mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Transition ObjectDeleteView to use ObjectPermissionRequiredMixin
This commit is contained in:
@@ -282,9 +282,9 @@ class ObjectEditView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View):
|
||||
"""
|
||||
Create or edit a single object.
|
||||
|
||||
queryset: The base queryset for the object being modified
|
||||
model_form: The form used to create or edit the object
|
||||
template_name: The name of the template
|
||||
:param queryset: The base queryset for the object being modified
|
||||
:param model_form: The form used to create or edit the object
|
||||
:param template_name: The name of the template
|
||||
"""
|
||||
queryset = None
|
||||
model_form = None
|
||||
@@ -389,16 +389,19 @@ class ObjectEditView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View):
|
||||
})
|
||||
|
||||
|
||||
class ObjectDeleteView(GetReturnURLMixin, View):
|
||||
class ObjectDeleteView(GetReturnURLMixin, ObjectPermissionRequiredMixin, View):
|
||||
"""
|
||||
Delete a single object.
|
||||
|
||||
queryset: The base queryset for the object being deleted
|
||||
template_name: The name of the template
|
||||
:param queryset: The base queryset for the object being deleted
|
||||
:param template_name: The name of the template
|
||||
"""
|
||||
queryset = None
|
||||
template_name = 'utilities/obj_delete.html'
|
||||
|
||||
def get_required_permission(self):
|
||||
return get_permission_for_model(self.queryset.model, 'delete')
|
||||
|
||||
def get_object(self, kwargs):
|
||||
# Look up object by slug if one has been provided. Otherwise, use PK.
|
||||
if 'slug' in kwargs:
|
||||
|
Reference in New Issue
Block a user