polls package

Submodules

polls.admaking module

polls.admaking.create_advert(request, poll_id)[source]
polls.admaking.html_to_pdf(html_filename, pdf_filename)[source]
polls.admaking.make_html_advert(request, poll_id, poll_obj)[source]
polls.admaking.make_pdf(request, poll_id)[source]

polls.admin module

class polls.admin.ChoiceInline(parent_model, admin_site)[source]

Bases: nested_inline.admin.NestedTabularInline

exclude = ('votes',)
extra = 1
media
model

alias of Choice

class polls.admin.ParticipantAdmin(model, admin_site)[source]

Bases: nested_inline.admin.NestedModelAdmin

list_display = ['user_information', 'poll', 'voted']
list_editable = ['voted']
list_filter = ['voted', 'poll']
media
search_fields = ['user_information__fio']
class polls.admin.ParticipantInline(parent_model, admin_site)[source]

Bases: nested_inline.admin.NestedTabularInline

exclude = ('user_information',)
fields = ('voted',)
list_dispay = ['userprofile']
media
model

alias of Participant

ordering = ('user_information',)
class polls.admin.PollAdmin(model, admin_site)[source]

Bases: nested_inline.admin.NestedModelAdmin

audit_button(obj)[source]
exclude = ('voted_users', 'times_mailed', 'last_mailing')
inlines = [<class 'polls.admin.ParticipantInline'>, <class 'polls.admin.QuestionInline'>]
list_display = ['name', 'pdf_button', 'audit_button', 'mailing_button']
mailing_button(obj)[source]
media
pdf_button(obj)[source]
save_model(request, obj, form, change)[source]
class polls.admin.QuestionAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

inlines = [<class 'polls.admin.ChoiceInline'>]
media
models

alias of Question

class polls.admin.QuestionInline(parent_model, admin_site)[source]

Bases: nested_inline.admin.NestedTabularInline

extra = 1
inlines = [<class 'polls.admin.ChoiceInline'>]
media
model

alias of Question

polls.app module

class polls.app.PollsConfig(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

name = 'polls'
ready()[source]
verbose_name = 'Голосовалка'

polls.forms module

class polls.forms.UserForm(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)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ('last_name', 'first_name')
model

alias of User

base_fields = OrderedDict([('last_name', <django.forms.fields.CharField object>), ('first_name', <django.forms.fields.CharField object>)])
declared_fields = OrderedDict()
media
class polls.forms.UserProfileForm(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)[source]

Bases: polls.forms.UserProfileFormReduced

class Meta[source]

Bases: polls.forms.Meta

fields = ('room', 'cardnumber')
base_fields = OrderedDict([('room', <django.forms.fields.CharField object>), ('cardnumber', <django.forms.fields.CharField object>)])
declared_fields = OrderedDict([('cardnumber', <django.forms.fields.CharField object>)])
media
class polls.forms.UserProfileFormReduced(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)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ('room',)
model

alias of UserProfile

base_fields = OrderedDict([('room', <django.forms.fields.CharField object>)])
declared_fields = OrderedDict()
media

polls.mailing module

polls.mailing.approve_mailing(request, poll_id)[source]
polls.mailing.is_staff(user)[source]
polls.mailing.mail_unvoted(request, poll_id)[source]

polls.models module

class polls.models.Choice(id, question, choice_text, votes, created)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

choice_text

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

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>
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 a ForwardManyToOneDescriptor instance.

question_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

save(*args, **kwargs)[source]
userhash_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 a ReverseManyToOneDescriptor instance.

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 polls.models.Participant(id, user_information, poll, voted)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

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 a ForwardManyToOneDescriptor instance.

poll_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user_information

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 a ForwardManyToOneDescriptor instance.

user_information_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

voted

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class polls.models.Poll(id, name, begin_date, end_date, target_room, target_group, target_course, public, times_mailed, last_mailing, poll_type, only_for_staff)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

POLL_TYPE = (('WITHOUT_TARGET_LIST', 'WITHOUT TARGET LIST'), ('TARGET_LIST', 'TARGET LIST'))
TARGET_LIST = 'TARGET_LIST'
WITHOUT_TARGET_LIST = 'WITHOUT_TARGET_LIST'
begin_date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

create_target_list_from_group_room_course(group=None, room=None, course=None, only_staff=False)[source]
end_date

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_begin_date(*moreargs, **morekwargs)
get_next_by_end_date(*moreargs, **morekwargs)
get_poll_type_display(*moreargs, **morekwargs)
get_previous_by_begin_date(*moreargs, **morekwargs)
get_previous_by_end_date(*moreargs, **morekwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_closed()[source]
is_started()[source]
is_user_target(user)[source]
is_user_voted(user)[source]
last_mailing

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name

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>
only_for_staff

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

participant_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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

poll_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

public

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

target_course

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

target_group

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

target_room

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

times_mailed

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

voted_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 and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class polls.models.Question(id, poll, question, answer_type, choices_order, required)[source]

Bases: django.db.models.base.Model

ANSWER_TYPE_CHOICES = (('ONE', 'Выбор одного варианта'), ('MANY', 'Выбор нескольких вариантов'), ('OWN', 'Свой вариант'))
CREATION = 'created'
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

MANY = 'MANY'
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

ONE = 'ONE'
ORDER_TYPES = (('created', 'В порядке добавления'), ('?', 'В случайном порядке'))
OWN = 'OWN'
RANDOM = '?'
answer_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

choices_order

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_answer_type_display(*moreargs, **morekwargs)
get_choices_order_display(*moreargs, **morekwargs)
get_ordered_choices()[source]
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 a ForwardManyToOneDescriptor instance.

poll_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

question

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

required

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class polls.models.UserHash(id, value, choice, user)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.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 a ForwardManyToOneDescriptor instance.

choice_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

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 a ForwardManyToOneDescriptor instance.

user_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

value

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polls.signals module

polls.signals.remind_to_vote(sender, request, **kwargs)[source]

polls.tests module

class polls.tests.PollTestCase(methodName='runTest')[source]

Bases: django.test.testcases.TestCase

setUp()[source]
test_vote_answer_type_MANY()[source]
test_vote_answer_type_ONE()[source]

polls.urls module

polls.views module

class polls.views.Available(**kwargs)[source]

Bases: polls.views.IndexBase

get_context_data(*args, **kwargs)[source]
get_queryset()[source]
class polls.views.Closed(**kwargs)[source]

Bases: polls.views.IndexBase

get_context_data(*args, **kwargs)[source]
get_queryset()[source]
class polls.views.Detail(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

get_context_data(**kwargs)[source]
model

alias of Poll

template_name = 'polls/detail.html'
class polls.views.Index(**kwargs)[source]

Bases: polls.views.Closed, polls.views.Available

get_context_data(*args, **kwargs)[source]
get_queryset()[source]
class polls.views.IndexBase(**kwargs)[source]

Bases: django.views.generic.list.ListView

context_object_name = 'poll_list'
paginate_by = 10
template_name = 'polls/index.html'
class polls.views.Results(**kwargs)[source]

Bases: django.views.generic.detail.DetailView

get_queryset()[source]
model

alias of Poll

template_name = 'polls/results.html'
class polls.views.Voted(**kwargs)[source]

Bases: polls.views.IndexBase

get_context_data(*args, **kwargs)[source]
get_queryset()[source]
polls.views.detailed(request, poll_id)[source]
polls.views.done(request)[source]
polls.views.is_staff(user)[source]
polls.views.make_csv(p, filename)[source]
polls.views.make_win_csv(oldfilename, filename)[source]
polls.views.vote(request, poll_id)[source]
polls.views.voters(request, poll_id)[source]

Module contents