def create(self, validated_data): max_slices = EqualSequenceSlicer().get_max_slices( validated_data['candies']) validated_data['max_slices'] = max_slices validated_data['is_valid_cake'] = CakeValidator().is_valid( validated_data) return ModelSerializer.create(self, validated_data)
def create(self, validated_data): validated_data['student'] = self.context['request'].user.profile validated_data['status'] = TicketStatus.pending.value ticket = ModelSerializer.create(self, validated_data) TicketEvent.objects.create(ticket=ticket, event_type=TicketEventType.create.value, user=ticket.student) return ticket