Referendums

Models

class ekratia.referendums.models.Referendum(*args, **kwargs)

Entity that refers to a proposal made by an user to modify the rules. It is opened for vote for a period of time and the members vote to approve it or not.

approved = None

True If approved, False if not approved, None not set yet

calculate_votes()

Calculates total votes based on ReferendumUserVote

check_status()

Method used to update status when necessary

comment

Comment thread

comment_points = None

Rating due to the comments, used to establish trendy referendums

count_comments()

Counts the comments of the referendunm, updates the value and returns the count.

Returns:count of comments
Return type:int
date = None

Date of creation

get_count_votes()

Calculates total votes for referenudm

get_graph()

Get graph of the referendum

Returns:Graph of the referendum
Return type:ekratia.core.graphs.GraphEkratia
get_num_negative_votes()

Return the total negative votes

get_num_positive_votes()

Returns total positive votes

get_total_votes()

Calculates total votes for referenudm

get_total_votes_absolute()

Returns Total ov votes for the referendum

is_approved()

Get partial results and determines if It’s approved or not

Returns:True or False
Return type:boolean
is_finished()

Method to establish id Referendum is open for vote.

Returns:True or False
Return type:boolean
is_open()

Method to establish id Referendum is open for vote.

Returns:True or False
Return type:boolean
num_comments = None

Number of comments

open_remaining_time()

Returns the remaining time for vote.

Returns:Remianing time for referendum to finish
Return type:datetime.timedelta()
open_time = None

Open Time of Referendum

points = None

Total Value of the Referndum

slug = None

Slugify version of the title

status = None

Status options: created, open, finished

text_add_rules = None

Text that will add to rules

text_remove_rules = None

Rules that will remove from rules

title = None

Title of the referendum

total_yes = None

Total Values for Stats

update_totals()

Update totals in the Database Returns the updated referendum

user

User who created referendum

vote_process(user, value)

Processes a vote for the referendum

Param:user User object
Param:value Vote value (-1 or 1)
class ekratia.referendums.models.ReferendumUserVote(*args, **kwargs)

ReferendumUserVote Model: Stores votes from users to Referendums

date = None

Time of the vote

referendum

ekratia.referendums.models.Referendum

user

ekratia.users.models.User

value = None

Vote Value

Views

class ekratia.referendums.views.ReferendumArchivedListView(**kwargs)

List of Referendums

model

alias of Referendum

class ekratia.referendums.views.ReferendumCreateView(**kwargs)

Creates a Referendum

form_class

alias of ReferendumForm

form_valid(form)

If the form is valid, save the associated model.

model

alias of Referendum

class ekratia.referendums.views.ReferendumDetailView(**kwargs)

Detail View for a Referendum

get_context_data(**kwargs)

Insert the single object into the context dict.

model

alias of Referendum

class ekratia.referendums.views.ReferendumListView(**kwargs)

List of Referendums

class ekratia.referendums.views.ReferendumOpenView(*args, **kwargs)

Open Referendum and redirects back to Referendum

class ekratia.referendums.views.ReferendumProcessVoteView(*args, **kwargs)

Process refrendum vote and redirects back to Referendum

class ekratia.referendums.views.ReferendumResultsView(**kwargs)

Referendum results

get_context_data(**kwargs)

Insert the single object into the context dict.

model

alias of Referendum

class ekratia.referendums.views.ReferendumVoteView(**kwargs)

Detail View for a Referendum

get_context_data(**kwargs)

Insert the single object into the context dict.