Add some limits to class cost and student count

This commit is contained in:
Tanner Collin 2020-11-15 05:10:52 +00:00
parent e69a65ae0b
commit d56a530312

View File

@ -379,6 +379,8 @@ class SessionSerializer(serializers.ModelSerializer):
datetime = serializers.DateTimeField() datetime = serializers.DateTimeField()
course = serializers.PrimaryKeyRelatedField(queryset=models.Course.objects.all()) course = serializers.PrimaryKeyRelatedField(queryset=models.Course.objects.all())
students = TrainingSerializer(many=True, read_only=True) students = TrainingSerializer(many=True, read_only=True)
max_students = serializers.IntegerField(min_value=1, max_value=50, allow_null=True)
cost = serializers.DecimalField(max_digits=None, decimal_places=2, min_value=0, max_value=200)
class Meta: class Meta:
model = models.Session model = models.Session