Prechádzať zdrojové kódy

Adjust inspector to accommodate non-detail views

jeremystretch 3 rokov pred
rodič
commit
927371b908
1 zmenil súbory, kde vykonal 1 pridanie a 1 odobranie
  1. 1 1
      netbox/utilities/custom_inspectors.py

+ 1 - 1
netbox/utilities/custom_inspectors.py

@@ -18,7 +18,7 @@ class NetBoxSwaggerAutoSchema(SwaggerAutoSchema):
         if not operation_id:
         if not operation_id:
             # Overwrite the action for bulk update/bulk delete views to ensure they get an operation ID that's
             # Overwrite the action for bulk update/bulk delete views to ensure they get an operation ID that's
             # unique from their single-object counterparts (see #3436)
             # unique from their single-object counterparts (see #3436)
-            if operation_keys[-1] in ('delete', 'partial_update', 'update') and not self.view.detail:
+            if operation_keys[-1] in ('delete', 'partial_update', 'update') and not getattr(self.view, 'detail', None):
                 operation_keys[-1] = f'bulk_{operation_keys[-1]}'
                 operation_keys[-1] = f'bulk_{operation_keys[-1]}'
             operation_id = '_'.join(operation_keys)
             operation_id = '_'.join(operation_keys)