Skip to content

Commit

Permalink
Automatically set the creator on newly posted semantic queries (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Jul 29, 2021
1 parent 1dca5b2 commit 831a983
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/items/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ class SemanticQuerySerializer(serializers.ModelSerializer):
class Meta:
model = SemanticQuery
fields = ['id', 'label', 'query']

def create(self, validated_data):
validated_data['creator'] = self.context['request'].user
return super().create(validated_data)

0 comments on commit 831a983

Please sign in to comment.