Override update to check M3U associations
(self, request, *args, **kwargs)
| 652 | return Response(serializer.data) |
| 653 | |
| 654 | def update(self, request, *args, **kwargs): |
| 655 | """Override update to check M3U associations""" |
| 656 | instance = self.get_object() |
| 657 | |
| 658 | # Check if group has M3U account associations |
| 659 | if hasattr(instance, 'm3u_account') and instance.m3u_account.exists(): |
| 660 | return Response( |
| 661 | {"error": "Cannot edit group with M3U account associations"}, |
| 662 | status=status.HTTP_400_BAD_REQUEST |
| 663 | ) |
| 664 | |
| 665 | return super().update(request, *args, **kwargs) |
| 666 | |
| 667 | def partial_update(self, request, *args, **kwargs): |
| 668 | """Override partial_update to check M3U associations""" |