intranet.apps.polls package¶
Submodules¶
intranet.apps.polls.admin module¶
intranet.apps.polls.forms module¶
- class intranet.apps.polls.forms.PollForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]¶
Bases:
ModelForm
- class Meta[source]¶
Bases:
object
- fields = ['title', 'description', 'start_time', 'end_time', 'visible', 'is_secret', 'is_election', 'groups']¶
- help_texts = {'is_election': 'Enable election formatting and results features.', 'is_secret': "This will prevent Ion administrators from viewing individual users' votes."}¶
- labels = {'is_election': 'Election', 'is_secret': 'Secret'}¶
- widgets = {'description': <django.forms.widgets.Textarea object>}¶
- declared_fields = {}¶
intranet.apps.polls.models module¶
- class intranet.apps.polls.models.Answer(id, question, user, choice, answer, clear_vote, other_vote, weight, rank)[source]¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- answer¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- choice¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- choice_id¶
- clear_vote¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- display_votes()[source]¶
Convert rank to votes for displaying by assigning rank 1 the max number of votes and continuing down.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- other_vote¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- question¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- question_id¶
- rank¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
- weight¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class intranet.apps.polls.models.AnswerVote(id, question, choice, votes, is_writing)[source]¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- choice¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- choice_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_writing¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- question¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- question_id¶
- users¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- votes¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class intranet.apps.polls.models.AnswerVote_users(id, answervote, user)¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- answervote¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- answervote_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
- class intranet.apps.polls.models.Choice(*args, **kwargs)[source]¶
Bases:
Model
A choice for a Question.
- question¶
A ForeignKey to the question this choice is for.
- num¶
An integer order in which the choice should appear; the primary sort.
- info¶
Textual information about this answer choice.
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- answer_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- answervote_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- info¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- num¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- question¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- question_id¶
- 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()
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- description¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- end_time¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_end_time(*, field=<django.db.models.fields.DateTimeField: end_time>, is_next=True, **kwargs)¶
- get_next_by_start_time(*, field=<django.db.models.fields.DateTimeField: start_time>, is_next=True, **kwargs)¶
- get_previous_by_end_time(*, field=<django.db.models.fields.DateTimeField: end_time>, is_next=False, **kwargs)¶
- get_previous_by_start_time(*, field=<django.db.models.fields.DateTimeField: start_time>, is_next=False, **kwargs)¶
- groups¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_election¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_secret¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <intranet.apps.polls.models.PollManager object>¶
- question_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- start_time¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- title¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- visible¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class intranet.apps.polls.models.PollQuerySet(model=None, query=None, using=None, hints=None)[source]¶
Bases:
QuerySet
- class intranet.apps.polls.models.Poll_groups(id, poll, group)¶
Bases:
Model
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- group¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- group_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- poll¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- poll_id¶
- class intranet.apps.polls.models.Question(*args, **kwargs)[source]¶
Bases:
Model
A question for a Poll.
- poll¶
A ForeignKey to the Poll object the question is for.
- question¶
A text field for entering the question, of which there are choices the user can make.
- num¶
An integer order in which the question should appear; the primary sort.
- type¶
- One of:
Question.STD: Standard Question.ELECTION: Election (randomized choice order) Question.RANK: Rank choice election Question.APP: Approval (can select up to max_choices entries) Question.SPLIT_APP: Split approval Question.FREE_RESP: Free response Question.STD_OTHER: Standard Other field
- max_choices¶
The maximum number of choices that can be selected. Only applies for approval questions.
- Access possible choices for this question through question.choice_set.all()
- APP = 'APP'¶
- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- ELECTION = 'ELC'¶
- FREE_RESP = 'FRE'¶
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- RANK = 'RAN'¶
- SHORT_RESP = 'SRE'¶
- SPLIT_APP = 'SAP'¶
- STD = 'STD'¶
- STD_OTHER = 'STO'¶
- TYPE = (('STD', 'Standard'), ('ELC', 'Election'), ('RAN', 'Rank choice'), ('APP', 'Approval'), ('SAP', 'Split approval'), ('FRE', 'Free response'), ('SRE', 'Short response'), ('STO', 'Standard other'))¶
- answer_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- answervote_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- choice_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- get_type_display(*, field=<django.db.models.fields.CharField: type>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- max_choices¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- num¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- poll¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- poll_id¶
- question¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property random_choice_set¶
- type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
intranet.apps.polls.tests module¶
- class intranet.apps.polls.tests.ApiTest(methodName='runTest')[source]¶
Bases:
IonTestCase
Tests for the polls module.