From 0fd64871a0298bc993f7d3bb03428bdc27cba17b Mon Sep 17 00:00:00 2001 From: Catalin Coroeanu Date: Fri, 18 Jan 2019 14:36:14 +0100 Subject: [PATCH] refactored the `save()` method for Question model --- survey/models.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/survey/models.py b/survey/models.py index 0a07f995..b1401bbc 100644 --- a/survey/models.py +++ b/survey/models.py @@ -52,8 +52,7 @@ class Question(models.Model): help_text='if the question type is "radio," "select," or "select multiple" provide a comma-separated list of options for this question .') def save(self, *args, **kwargs): - if (self.question_type == Question.RADIO or self.question_type == Question.SELECT - or self.question_type == Question.SELECT_MULTIPLE): + if self.question_type in [Question.RADIO, Question.SELECT, Question.SELECT_MULTIPLE]: validate_list(self.choices) super(Question, self).save(*args, **kwargs)