You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parima Sangsirakoup edited this page Sep 16, 2024
·
16 revisions
Domain Model
Iteration 1 Domain Model
Question class contains question_text and pub_date, each question can have many Choices which each one contains choice_text and votes.
Iteration 2 Domain Model
Additional attribute end_date for Question.
Iteration 3 and 4 Domain Model
Add User and Vote models. Only authenticated user can vote to the poll and they get only 1 vote per poll.
From lasted model which we can get total votes of each choice from Choice.votes, we will use this method instead.
def votes(choice: Choice) -> int:`
"""Return the total number of votes for a choice."""`
return Votes.objects.get(choice = choice).count()