Skip to content

Commit

Permalink
API: Add motion seq field back for rounds
Browse files Browse the repository at this point in the history
The sequence field had been removed in the Round API endpoint in favour
of relying on the ordering in the array. However, as the field was still
in use, it caused an unintended breakage. The sequence will now remain,
but be read-only as we look to the ordering when creating them.
  • Loading branch information
tienne-B committed Jan 25, 2024
1 parent 8e06b6c commit 3a5b2df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tabbycat/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ class RoundMotionSerializer(serializers.ModelSerializer):
text = serializers.CharField(source='motion.text', max_length=500, required=False)
reference = serializers.CharField(source='motion.reference', max_length=100, required=False)
info_slide = serializers.CharField(source='motion.info_slide', required=False)
seq = serializers.IntegerField(read_only=True)

class Meta:
model = RoundMotion
exclude = ('round', 'motion', 'seq')
exclude = ('round', 'motion')

def create(self, validated_data):
motion_data = validated_data.pop('motion')
Expand Down

0 comments on commit 3a5b2df

Please sign in to comment.