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 (
ForeignKey
toQuestion
) – Question (related name:answer
)user (
ForeignKey
toUser
) – User (related name:answer
)choice (
ForeignKey
toChoice
) – Choice (related name:answer
)
Methods
Convert rank to votes for displaying by assigning rank 1 the max number of votes and continuing down.
Attributes
answer
Type:
CharField
choice
Type:
ForeignKey
toChoice
choice_id
Internal field, use
choice
instead.clear_vote
Type:
BooleanField
id
Type:
AutoField
objects
other_vote
Type:
BooleanField
question
Type:
ForeignKey
toQuestion
question_id
Internal field, use
question
instead.rank
Type:
IntegerField
user
Type:
ForeignKey
toUser
user_id
Internal field, use
user
instead.weight
Type:
DecimalField