Skip to content

Commit

Permalink
Require private data have an owner
Browse files Browse the repository at this point in the history
  • Loading branch information
summerhenson committed Feb 7, 2025
1 parent fd8d3fe commit bd37872
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sasdata/fair_database/data/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@
class DataSerializer(serializers.ModelSerializer):
class Meta:
model = Data
fields = "__all__"
fields = "__all__"

def validate(self, data):
print(data)
if not data['is_public'] and not data['current_user']:
raise serializers.ValidationError('private data must have an owner')
return data

0 comments on commit bd37872

Please sign in to comment.