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

Method update

apps/m3u/serializers.py:94–107  ·  view source on GitHub ↗
(self, instance, validated_data)

Source from the content-addressed store, hash-verified

92 return data
93
94 def update(self, instance, validated_data):
95 if instance.is_default:
96 # For default profiles, only allow updating name, custom_properties, exp_date, and patterns
97 allowed_fields = {'name', 'custom_properties', 'exp_date', 'search_pattern', 'replace_pattern'}
98
99 # Remove any fields that aren't allowed for default profiles
100 disallowed_fields = set(validated_data.keys()) - allowed_fields
101 if disallowed_fields:
102 raise serializers.ValidationError(
103 f"Default profiles can only modify name, notes, expiration, and URL patterns. "
104 f"Cannot modify: {', '.join(disallowed_fields)}"
105 )
106
107 return super().update(instance, validated_data)
108
109 def destroy(self, request, *args, **kwargs):
110 instance = self.get_object()

Callers

nothing calls this directly

Calls 2

keysMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected