Skip to content
Snippets Groups Projects
Commit 34afdc2d authored by Bodor Máté's avatar Bodor Máté
Browse files

Correct event valodator

parent 88ec4cd0
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ class StaffEventSerializer(serializers.ModelSerializer):
return obj.visitors.all().count()
def validate(self, data):
if data['absent'] is not None and data['visitors'] is not None:
if 'absent' in data and 'visitors' in data:
for i in data['absent']:
if i in data['visitors']:
raise serializers.ValidationError('You cant add a student to absent and visitor in the same time.')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment