MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / destroy

Method destroy

apps/channels/api_views.py:715–733  ·  view source on GitHub ↗

Override destroy to check for associations before deletion

(self, request, *args, **kwargs)

Source from the content-addressed store, hash-verified

713 })
714
715 def destroy(self, request, *args, **kwargs):
716 """Override destroy to check for associations before deletion"""
717 instance = self.get_object()
718
719 # Check if group has associated channels
720 if instance.channels.exists():
721 return Response(
722 {"error": "Cannot delete group with associated channels"},
723 status=status.HTTP_400_BAD_REQUEST
724 )
725
726 # Check if group has M3U account associations
727 if hasattr(instance, 'm3u_account') and instance.m3u_account.exists():
728 return Response(
729 {"error": "Cannot delete group with M3U account associations"},
730 status=status.HTTP_400_BAD_REQUEST
731 )
732
733 return super().destroy(request, *args, **kwargs)
734
735
736# ─────────────────────────────────────────────────────────

Callers

nothing calls this directly

Calls 2

existsMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected