diff --git a/organizations/serializers.py b/organizations/serializers.py index 8327c76..d60f3d2 100644 --- a/organizations/serializers.py +++ b/organizations/serializers.py @@ -25,12 +25,21 @@ def update_logo(self, obj, logo_url): obj.logo.save(logo_url.split('/')[-1], ContentFile(logo.content)) def create(self, validated_data): + """ + New organizations created through the API are always Active + """ + validated_data.update({'active': True}) logo_url = validated_data.pop('logo_url', None) obj = super().create(validated_data) self.update_logo(obj, logo_url) return obj def update(self, instance, validated_data): + """ + Existing organizations updated through the API always end up Active, + regardless of whether or not they were previously active + """ + validated_data.update({'active': True}) logo_url = validated_data.pop('logo_url', None) super().update(instance, validated_data) self.update_logo(instance, logo_url) diff --git a/organizations/v0/views.py b/organizations/v0/views.py index 02e15b9..36c2f37 100644 --- a/organizations/v0/views.py +++ b/organizations/v0/views.py @@ -60,7 +60,6 @@ def update(self, request, *args, **kwargs): raise ValidationError( "Value of 'active' may not be specified via Organizations HTTP API." ) - self.request.data['active'] = True try: return super().update(request, *args, **kwargs) except Http404: