Skip to content

Commit

Permalink
[FIX] website_slides: clean some model-related parameters
Browse files Browse the repository at this point in the history
Quiz questions and answers should be translatable as they are intended
for end users and are displayed in courses frontend. Some required fields
are also missing. Some docstrings are cleaned.

Commit linked to task ID 1941250 and PR #31272.
  • Loading branch information
tde-banana-odoo committed Feb 20, 2019
1 parent c6f473a commit 0e56426
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions addons/website_slides/models/slide_question.py
Expand Up @@ -8,14 +8,11 @@
class SlideQuestion(models.Model):
_name = "slide.question"
_rec_name = "question"
_description = """
Question for a slide. A slide can have multiple questions and each question
must have at least 2 possible answers and only one good answer.
"""
_description = "Slide Quiz Question"

sequence = fields.Integer("Sequence", default=10)
question = fields.Char("Question Name", required=True)
slide_id = fields.Many2one('slide.slide', string="Slide")
question = fields.Char("Question Name", required=True, translate=True)
slide_id = fields.Many2one('slide.slide', string="Slide", required=True)
answer_ids = fields.One2many('slide.answer', 'question_id', string="Answer")

@api.constrains('answer_ids')
Expand Down Expand Up @@ -44,8 +41,9 @@ def _check_at_least_2_answers(self):
class SlideAnswer(models.Model):
_name = "slide.answer"
_rec_name = "text_value"
_description = """Answer for a slide question"""
_description = "Answer for a slide question"
_order = 'question_id, id'

question_id = fields.Many2one('slide.question', string="Question")
text_value = fields.Char("Answer", required=True,)
is_correct = fields.Boolean("Is correct answer", default=False)
question_id = fields.Many2one('slide.question', string="Question", required=True)
text_value = fields.Char("Answer", required=True, translate=True)
is_correct = fields.Boolean("Is correct answer")

0 comments on commit 0e56426

Please sign in to comment.