Answer¶
Qualified name: intranet.apps.polls.models.Answer
- class intranet.apps.polls.models.Answer(id, question, user, choice, answer, clear_vote, other_vote, weight, rank)[source]¶
Bases:
Model- Parameters:
id (AutoField) – Primary key: ID
answer (CharField) – Answer
clear_vote (BooleanField) – Clear vote
other_vote (BooleanField) – Other vote
weight (DecimalField) – Weight
rank (IntegerField) – Rank
Relationship fields:
- Parameters:
question (
ForeignKeytoQuestion) – Question (related name:answer)user (
ForeignKeytoUser) – User (related name:answer)choice (
ForeignKeytoChoice) – Choice (related name:answer)
Methods
Convert rank to votes for displaying by assigning rank 1 the max number of votes and continuing down.
Attributes
answerType:
CharFieldchoiceType:
ForeignKeytoChoicechoice_idInternal field, use
choiceinstead.clear_voteType:
BooleanFieldidType:
AutoFieldobjectsother_voteType:
BooleanFieldquestionType:
ForeignKeytoQuestionquestion_idInternal field, use
questioninstead.rankType:
IntegerFielduserType:
ForeignKeytoUseruser_idInternal field, use
userinstead.weightType:
DecimalField