Poll

Qualified name: intranet.apps.polls.models.Poll

class intranet.apps.polls.models.Poll(*args, **kwargs)[source]

Bases: Model

A Poll, for the TJ community.

title

A title for the poll, that will be displayed to identify it uniquely.

description

A longer description, possibly explaining how to complete the poll.

start_time

A time that the poll should open.

end_time

A time that the poll should close.

visible

Whether the poll is visible to the users it is for.

is_secret

Whether the poll is a ‘secret’ poll. Poll admins will not be able to view individual user responses for secret polls.

is_election

Whether the poll is an election.

groups

The Groups that can view and vote in the poll. Like Announcements, if there are none set, then it is public to all.

Access questions for the poll through poll.question_set.all()

Parameters:

Relationship fields:

Parameters:

groups (ManyToManyField to Group) – Groups (related name: poll)

Reverse relationships:

Parameters:

question (Reverse ForeignKey from Question) – All questions of this poll (related name of poll)

Methods

before_end_time

Has the poll not ended yet?

before_start_time

Has the poll not started yet?

can_vote

get_next_by_end_time

Finds next instance based on end_time.

get_next_by_start_time

Finds next instance based on start_time.

get_num_eligible_voters

get_percentage_voted

get_previous_by_end_time

Finds previous instance based on end_time.

get_previous_by_start_time

Finds previous instance based on start_time.

get_users_voted

get_voted_string

has_user_voted

in_time_range

Is it within the poll time range?

Attributes

before_end_time()[source]

Has the poll not ended yet?

before_start_time()[source]

Has the poll not started yet?

in_time_range()[source]

Is it within the poll time range?