blob: 6e15c87c6f2a07a4512af99983e0de735fc5082e [file] [log] [blame]
#summary Question entity model
#labels Phase-Design,Contents-Skeleton,Design-Model
_*Eventually, this topic should be populated by the output of*_ `pydoc`.
{{{
class Question(db.Model):
"""Model of a Question asked in a Review.
A Question entity participates in a number of relationships:
reviews) a many:many relationship between available Questions and the
Reviews that ask them. See the ReviewsQuestions model for details.
answers) a 1:many relationship of the many specific Answers to this
particular question. Since the same Question can be asked in many
different Reviews based on different Review "templates" containing
different question mixes, this relationship is probably not particularly
useful, but is included for completeness.
question: required db.StringProperty containing the actual question text.
Questions can be indexed, filtered, and sorted by 'question'.
styles: required db.ListProperty that indicates the style(s) of
thes Question. The 'styles' list must contain at least one of:
"text_short": a Unicode string is expected in the Answer 'short' field.
"text_long": Unicode text is expected in the Answer 'long' field.
"pick_one": exactly one string present in the pick_choices list
in this Question is expected in the Answer 'picks' list.
"pick_many": one or more strings present in the pick_choices list
in this Question is expected in the Answer 'picks' list.
The various "pick_" choices are mutually exclusive, but can be
combined with the "text_" choices. For example, a "pick_one"
pick_choices list may have an "other" value, and the "text_short"
field is then used for free-form text input to elaborate on the
"other" choice.
For another example, a "pick_many" style might be combined with a
"text_long" style where the question text indicates that the
"text_long" field is available for additional comments. Of course,
this example could also be implemented as two separate Questions.
pick_choices: db.ListProperty containing short strings that represent the
selected "values" in pick_one and pick_many Questions. These values
must be unique within this pick_choices list and must be compatible with
being used in <SELECT> and <OPTION> controls in HTML forms.
pick_labels: db.ListProperty containing Unicode strings that are the
human-readable representations of the corresponding short strings in
the pick_choices list. These labels are paired with the pick_choices
strings in the same order. If one (or more) of the label strings in
this list is the empty string, the pick_choices string will be displayed
instead (in forms, generated reports, etc.).
approval_style: optional db.StringProperty that indicates which *one* of
the question styles in the 'styles' list is used to interpret the
approval_answers list. Not all question styles have corresponding
approval styles. The supported approval styles are:
"match_short": one of the strings found in approval_answers must be
present in (exactly match) the Answer 'short' field string for
the question to indicate "approval". ("text_short" must be present
in pick_choices for this approval style to be valid.)
"match_only_one": the *one* value in the Answer 'picks' list must
be present in the approval_answers list to indicate "approval".
("pick_one" must be present in pick_choices for this approval style
to be valid.)
"match_all": all of the values in the approval_answers list must be
present in the Answer 'picks' list to indicate "approval".
("pick_many" must be present in pick_choices for this approval style
to be valid.)
Other potential approval styles are possible and may be added in the
future.
approval_answers: optional db.ListProperty containing strings that
list the Answer values that indicate "approval" (or "passing grade") for
the Question. If this list is empty and the approval_style string is
empty, the Question is not treated as an "approval" question for Reviews
that ask it.
"""
question = db.StringProperty(required=True)
styles = db.ListProperty(item_type=str)
pick_choices = db.ListProperty(item_type=str)
pick_labels = db.ListProperty(item_type=unicode)
approval_style = db.StringProperty()
approval_answers = db.ListProperty(item_type=str)
}}}
----
_Copyright 2008 Google Inc._
_This work is licensed under a_
[http://soc.googlecode.com/svn/wiki/html/licenses/cc-by-attribution-2_5.html Creative Commons Attribution 2.5 License].
[http://creativecommons.org/licenses/by/2.5/ http://soc.googlecode.com/svn/wiki/html/licenses/cc-by-2_5-88x31.png]