File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -543,6 +543,19 @@ def get_object(self, **kwargs):
543543 model = object_type .get_model ()
544544 return get_object_or_404 (model .objects .all (), ** self .kwargs )
545545
546+ def get_return_url (self , request , obj = None ):
547+ """
548+ Return the URL to redirect to after deleting a custom object.
549+ """
550+ if obj :
551+ # Get the custom object type from the object directly
552+ custom_object_type = obj .custom_object_type .name
553+ else :
554+ # Fallback to getting it from kwargs if object is not available
555+ custom_object_type = self .kwargs .get ("custom_object_type" )
556+
557+ return reverse ("plugins:netbox_custom_objects:customobject_list" , kwargs = {"custom_object_type" : custom_object_type })
558+
546559
547560@register_model_view (CustomObject , "bulk_edit" , path = "edit" , detail = False )
548561class CustomObjectBulkEditView (CustomObjectTableMixin , generic .BulkEditView ):
You can’t perform that action at this time.
0 commit comments