Skip to content

Commit

Permalink
Allow markdown in survey question descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
panagiotappl committed Sep 19, 2018
1 parent 03feddf commit 9b08950
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions indico/modules/events/surveys/models/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from indico.core.db import db
from indico.core.db.sqlalchemy import PyIntEnum
from indico.core.db.sqlalchemy.descriptions import DescriptionMixin, RenderMode
from indico.modules.events.surveys.fields import get_field_types
from indico.util.string import return_ascii, text_to_repr
from indico.util.struct.enum import IndicoEnum
Expand All @@ -44,7 +45,7 @@ class SurveyItemType(int, IndicoEnum):
text = 3


class SurveyItem(db.Model):
class SurveyItem(db.Model, DescriptionMixin):
__tablename__ = 'items'
__table_args__ = (db.CheckConstraint("type != {type} OR ("
"title IS NOT NULL AND "
Expand Down Expand Up @@ -75,6 +76,9 @@ class SurveyItem(db.Model):
'polymorphic_identity': None
}

possible_render_modes = {RenderMode.markdown}
default_render_mode = RenderMode.markdown

#: The ID of the item
id = db.Column(
db.Integer,
Expand Down Expand Up @@ -111,12 +115,6 @@ class SurveyItem(db.Model):
nullable=True,
default=_get_item_default_title
)
#: The description of the item
description = db.Column(
db.Text,
nullable=False,
default=''
)
#: If a section should be rendered as a section
display_as_section = db.Column(
db.Boolean,
Expand Down

0 comments on commit 9b08950

Please sign in to comment.