Allow creating question with dependency_question=None (#1607)

This commit is contained in:
pajowu
2020-03-12 13:30:18 +01:00
committed by GitHub
parent 58717850c2
commit d76ce47597
2 changed files with 40 additions and 2 deletions

View File

@@ -287,8 +287,8 @@ class QuestionSerializer(I18nAwareModelSerializer):
if value:
if value.type not in (Question.TYPE_CHOICE, Question.TYPE_BOOLEAN, Question.TYPE_CHOICE_MULTIPLE):
raise ValidationError('Question dependencies can only be set to boolean or choice questions.')
if value == self.instance:
raise ValidationError('A question cannot depend on itself.')
if value == self.instance:
raise ValidationError('A question cannot depend on itself.')
return value
def validate(self, data):