oioioi.participants.controllers

Module Contents

Classes

ParticipantsController

A base class for classes which should have a list of subclasses

OpenParticipantsController

A base class for classes which should have a list of subclasses

EmailShowContestControllerMixin

Contest controller defines whether in participants' data view email

AnonymousContestControllerMixin

ContestController mixin that adds participants info for anonymous

OnsiteRegistrationController

A base class for classes which should have a list of subclasses

OnsiteContestControllerMixin

ContestController mixin that sets up an onsite contest.

Functions

Attributes

oioioi.participants.controllers.auditLogger[source]
class oioioi.participants.controllers.ParticipantsController(contest)[source]

Bases: oioioi.contests.controllers.RegistrationController

A base class for classes which should have a list of subclasses available.

The list of subclasses is available in their subclasses class attributes. Classes which have explicitly set abstract class attribute to True are not added to subclasses.

If a class has modules_with_subclasses attribute (list or string), then specified modules for all installed applications can be loaded by calling load_subclasses().

property form_class[source]
property participant_admin[source]
registration_template = participants/registration.html[source]
classmethod anonymous_can_enter_contest()[source]

Determines if an anonymous user can enter the contest.

Allowed anonymous users will have limited functionality, but they can see the problems, review questions etc. Modules should give them as much functionality as reasonably possible.

Return type

bool

allow_login_as_public_name()[source]

Determines if participants may choose to stay anonymous, i.e. use their logins as public names.

filter_participants(queryset)[source]

Filters the queryset of User to select only users which have access to the contest.

user_contests_query(request)[source]

Provides a django.db.models.Q expression which can be used on oioioi.contests.models.Contest queryset already limited to contests using this controller to filter for contests the user has entered.

It must not make use of attribute contest of the controller, as it is not guaranteed to be set. It is called with None contest in :function:`oioioi.contests.utils.visible_contests`.

filter_users_with_accessible_personal_data(queryset)[source]

Filters the queryset of User to select only users whose personal data is accessible to the admins.

can_register(request)[source]
can_edit_registration(request, participant)[source]
can_unregister(request, participant)[source]
no_entry_view(request)[source]

View rendered when a user would like to perform an action not allowed by this registration controller.

This may be a good place to put a redirection to a registration page etc.

The default implementation just raises PermissionDenied.

get_model_class()[source]

Returns registration model class used within current registration controller.

The default implementation infers it from form_class form metadata. If there is no form_class, the default implementation returns None.

get_form(request, participant=None)[source]
handle_validated_form(request, form, participant)[source]
_get_participant_for_form(request)[source]
registration_view(request)[source]
get_terms_accepted_phrase()[source]
can_change_terms_accepted_phrase(request)[source]
Returns

Whether the given contest has custom registered

participants (like the ones in OI and PA). Then and only then we allow to change terms accepted phrase.

is_registration_open(request)[source]
class oioioi.participants.controllers.OpenParticipantsController(contest)[source]

Bases: ParticipantsController

A base class for classes which should have a list of subclasses available.

The list of subclasses is available in their subclasses class attributes. Classes which have explicitly set abstract class attribute to True are not added to subclasses.

If a class has modules_with_subclasses attribute (list or string), then specified modules for all installed applications can be loaded by calling load_subclasses().

property form_class[source]
classmethod anonymous_can_enter_contest()[source]

Determines if an anonymous user can enter the contest.

Allowed anonymous users will have limited functionality, but they can see the problems, review questions etc. Modules should give them as much functionality as reasonably possible.

Return type

bool

allow_login_as_public_name()[source]

Determines if participants may choose to stay anonymous, i.e. use their logins as public names.

can_enter_contest(request)[source]

Determines if the current user is allowed to enter the contest, i.e. see any page related to the contest.

The default implementation uses filter_visible_contests() with a single-element contest queryset.

Return type

bool

visible_contests_query(request)[source]

Provides a django.db.models.Q expression which can be used on oioioi.contests.models.Contest queryset already limited to contests using this controller to filter for contests the user can enter.

It must not make use of attribute contest of the controller, as it is not guaranteed to be set. It is called with None contest in :function:`oioioi.contests.utils.visible_contests`.

can_register(request)[source]
can_unregister(request, participant)[source]
oioioi.participants.controllers.anonymous_participants(request)[source]
class oioioi.participants.controllers.EmailShowContestControllerMixin[source]

Bases: object

Contest controller defines whether in participants’ data view email should be shown. That is a case in OI-type contest.

show_email_in_participants_data = False[source]
class oioioi.participants.controllers.AnonymousContestControllerMixin[source]

Bases: object

ContestController mixin that adds participants info for anonymous contests.

get_user_public_name(request, user)[source]
get_contest_participant_info_list(request, user)[source]
class oioioi.participants.controllers.OnsiteRegistrationController(contest)[source]

Bases: ParticipantsController

A base class for classes which should have a list of subclasses available.

The list of subclasses is available in their subclasses class attributes. Classes which have explicitly set abstract class attribute to True are not added to subclasses.

If a class has modules_with_subclasses attribute (list or string), then specified modules for all installed applications can be loaded by calling load_subclasses().

property participant_admin[source]
get_model_class()[source]

Returns registration model class used within current registration controller.

The default implementation infers it from form_class form metadata. If there is no form_class, the default implementation returns None.

can_register(request)[source]
can_edit_registration(request, participant)[source]
get_contest_participant_info_list(request, user)[source]

Returns a list of tuples (priority, info). Each entry represents a fragment of HTML with information about the user’s participation in the contest. This information will be visible for contest admins. It can be any information an application wants to add.

The fragments are sorted by priority (descending) and rendered in that order.

The default implementation returns basic info about the contestant: his/her full name, e-mail, the user id, his/her submissions and round time extensions.

To add additional info from another application, override this method. For integrity, include the result of the parent implementation in your output.

class oioioi.participants.controllers.OnsiteContestControllerMixin[source]

Bases: object

ContestController mixin that sets up an onsite contest.

create_forum = False[source]
registration_controller()[source]
should_confirm_submission_receipt(request, submission)[source]
is_onsite()[source]