Skip to content

Domain Model

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.
Iteration1

Iteration 2 Domain Model

Additional attribute end_date for Question.
Iteration2

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. Iteration3
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()

`

Clone this wiki locally