:py:mod:`oioioi.participants.controllers` ========================================= .. py:module:: oioioi.participants.controllers Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.participants.controllers.ParticipantsController oioioi.participants.controllers.OpenParticipantsController oioioi.participants.controllers.EmailShowContestControllerMixin oioioi.participants.controllers.AnonymousContestControllerMixin oioioi.participants.controllers.OnsiteRegistrationController oioioi.participants.controllers.OnsiteContestControllerMixin Functions ~~~~~~~~~ .. autoapisummary:: oioioi.participants.controllers.anonymous_participants Attributes ~~~~~~~~~~ .. autoapisummary:: oioioi.participants.controllers.auditLogger .. py:data:: auditLogger .. py:class:: ParticipantsController(contest) Bases: :py:obj:`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 :attr:`subclasses` class attributes. Classes which have *explicitly* set :attr:`abstract` class attribute to ``True`` are not added to :attr:`subclasses`. If a class has ``modules_with_subclasses`` attribute (list or string), then specified modules for all installed applications can be loaded by calling :meth:`~RegisteredSubclassesBase.load_subclasses`. .. py:property:: form_class .. py:property:: participant_admin .. py:attribute:: registration_template :annotation: = participants/registration.html .. py:method:: anonymous_can_enter_contest() :classmethod: 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. :rtype: bool .. py:method:: allow_login_as_public_name() Determines if participants may choose to stay anonymous, i.e. use their logins as public names. .. py:method:: filter_participants(queryset) Filters the queryset of :class:`~django.contrib.auth.model.User` to select only users which have access to the contest. .. py:method:: user_contests_query(request) Provides a :class:`django.db.models.Q` expression which can be used on :class:`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`. .. py:method:: filter_users_with_accessible_personal_data(queryset) Filters the queryset of :class:`~django.contrib.auth.model.User` to select only users whose personal data is accessible to the admins. .. py:method:: can_register(request) .. py:method:: can_edit_registration(request, participant) .. py:method:: can_unregister(request, participant) .. py:method:: no_entry_view(request) 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``. .. py:method:: get_model_class() 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``. .. py:method:: get_form(request, participant=None) .. py:method:: handle_validated_form(request, form, participant) .. py:method:: _get_participant_for_form(request) .. py:method:: registration_view(request) .. py:method:: get_terms_accepted_phrase() .. py:method:: can_change_terms_accepted_phrase(request) :return: 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. .. py:method:: is_registration_open(request) .. py:class:: OpenParticipantsController(contest) Bases: :py:obj:`ParticipantsController` A base class for classes which should have a list of subclasses available. The list of subclasses is available in their :attr:`subclasses` class attributes. Classes which have *explicitly* set :attr:`abstract` class attribute to ``True`` are not added to :attr:`subclasses`. If a class has ``modules_with_subclasses`` attribute (list or string), then specified modules for all installed applications can be loaded by calling :meth:`~RegisteredSubclassesBase.load_subclasses`. .. py:property:: form_class .. py:method:: anonymous_can_enter_contest() :classmethod: 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. :rtype: bool .. py:method:: allow_login_as_public_name() Determines if participants may choose to stay anonymous, i.e. use their logins as public names. .. py:method:: can_enter_contest(request) Determines if the current user is allowed to enter the contest, i.e. see any page related to the contest. The default implementation uses :meth:`filter_visible_contests` with a single-element contest queryset. :rtype: bool .. py:method:: visible_contests_query(request) Provides a :class:`django.db.models.Q` expression which can be used on :class:`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`. .. py:method:: can_register(request) .. py:method:: can_unregister(request, participant) .. py:function:: anonymous_participants(request) .. py:class:: EmailShowContestControllerMixin Bases: :py:obj:`object` Contest controller defines whether in participants' data view email should be shown. That is a case in OI-type contest. .. py:attribute:: show_email_in_participants_data :annotation: = False .. py:class:: AnonymousContestControllerMixin Bases: :py:obj:`object` ContestController mixin that adds participants info for anonymous contests. .. py:method:: get_user_public_name(request, user) .. py:method:: get_contest_participant_info_list(request, user) .. py:class:: OnsiteRegistrationController(contest) Bases: :py:obj:`ParticipantsController` A base class for classes which should have a list of subclasses available. The list of subclasses is available in their :attr:`subclasses` class attributes. Classes which have *explicitly* set :attr:`abstract` class attribute to ``True`` are not added to :attr:`subclasses`. If a class has ``modules_with_subclasses`` attribute (list or string), then specified modules for all installed applications can be loaded by calling :meth:`~RegisteredSubclassesBase.load_subclasses`. .. py:property:: participant_admin .. py:method:: get_model_class() 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``. .. py:method:: can_register(request) .. py:method:: can_edit_registration(request, participant) .. py:method:: get_contest_participant_info_list(request, user) 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. .. py:class:: OnsiteContestControllerMixin Bases: :py:obj:`object` ContestController mixin that sets up an onsite contest. .. py:attribute:: create_forum :annotation: = False .. py:method:: registration_controller() .. py:method:: should_confirm_submission_receipt(request, submission) .. py:method:: is_onsite()