:py:mod:`oioioi.participants.admin` =================================== .. py:module:: oioioi.participants.admin Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.participants.admin.ParticipantAdmin oioioi.participants.admin.NoParticipantAdmin oioioi.participants.admin.ContestDependentParticipantAdmin oioioi.participants.admin.ParticipantInline oioioi.participants.admin.RegionAdmin oioioi.participants.admin.OnsiteRegistrationInline oioioi.participants.admin.RegionFilter oioioi.participants.admin.OnsiteRegistrationParticipantAdmin oioioi.participants.admin.RegionListFilter oioioi.participants.admin.OnsiteSubmissionAdminMixin oioioi.participants.admin.UserWithParticipantsAdminMixin oioioi.participants.admin.ParticipantsRoundTimeExtensionMixin oioioi.participants.admin.TermsAcceptedPhraseInline oioioi.participants.admin.TermsAcceptedPhraseAdminMixin .. py:class:: ParticipantAdmin(model, admin_site) Bases: :py:obj:`oioioi.base.admin.ModelAdmin` Encapsulate all admin options and functionality for a given model. .. py:attribute:: list_select_related :annotation: = True .. py:attribute:: list_display :annotation: = ['user_login', 'user_full_name', 'status'] .. py:attribute:: list_filter :annotation: = ['status'] .. py:attribute:: fields :annotation: = [['user', 'status']] .. py:attribute:: search_fields :annotation: = ['user__username', 'user__last_name'] .. py:attribute:: actions :annotation: = ['make_active', 'make_banned', 'delete_selected', 'extend_round'] .. py:attribute:: form .. py:attribute:: short_description .. py:attribute:: admin_order_field :annotation: = user__username .. py:attribute:: short_description .. py:attribute:: admin_order_field :annotation: = user__last_name .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: short_description .. py:method:: has_add_permission(request) Return True if the given request has permission to add an object. Can be overridden by the user in subclasses. .. py:method:: has_change_permission(request, obj=None) Return True if the given request has permission to change the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the `obj` model instance. If `obj` is None, this should return True if the given request has permission to change *any* object of the given type. .. py:method:: has_delete_permission(request, obj=None) Return True if the given request has permission to delete the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the `obj` model instance. If `obj` is None, this should return True if the given request has permission to delete *any* object of the given type. .. py:method:: user_login(instance) .. py:method:: user_full_name(instance) .. py:method:: get_custom_list_select_related() Returns a list of fields passed to queryset.select_related By default - empty list. Override this method (instead of get_queryset()) to pass another field to the select_related. .. py:method:: get_list_display(request) Return a sequence containing the fields to be displayed on the changelist. .. py:method:: get_queryset(request) Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view. .. py:method:: save_model(request, obj, form, change) Given a model instance save it to the database. .. py:method:: get_form(request, obj=None, **kwargs) Return a Form class for use in the admin add view. This is used by add_view and change_view. .. py:method:: formfield_for_foreignkey(db_field, request, **kwargs) Get a form Field for a ForeignKey. .. py:method:: make_active(request, queryset) .. py:method:: make_banned(request, queryset) .. py:method:: extend_round(request, queryset) .. py:class:: NoParticipantAdmin(model, admin_site) Bases: :py:obj:`ParticipantAdmin` Encapsulate all admin options and functionality for a given model. .. py:method:: has_add_permission(request) Return True if the given request has permission to add an object. Can be overridden by the user in subclasses. .. py:method:: has_change_permission(request, obj=None) Return True if the given request has permission to change the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the `obj` model instance. If `obj` is None, this should return True if the given request has permission to change *any* object of the given type. .. py:method:: has_delete_permission(request, obj=None) Return True if the given request has permission to delete the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the `obj` model instance. If `obj` is None, this should return True if the given request has permission to delete *any* object of the given type. .. py:class:: ContestDependentParticipantAdmin(model, admin_site) Bases: :py:obj:`oioioi.base.admin.InstanceDependentAdmin` Encapsulate all admin options and functionality for a given model. .. py:attribute:: default_participant_admin .. py:method:: _find_model_admin(request, object_id) .. py:method:: _model_admin_for_instance(request, instance=None) :abstractmethod: .. py:class:: ParticipantInline(parent_model, admin_site) Bases: :py:obj:`oioioi.base.admin.TabularInline` Options for inline editing of ``model`` instances. Provide ``fk_name`` to specify the attribute name of the ``ForeignKey`` from ``model`` to its parent. This is required if ``model`` has more than one ``ForeignKey`` to its parent. .. py:attribute:: model .. py:attribute:: extra :annotation: = 0 .. py:attribute:: readonly_fields :annotation: = ['contest', 'status'] .. py:method:: has_add_permission(request, obj=None) Return True if the given request has permission to add an object. Can be overridden by the user in subclasses. .. py:method:: has_change_permission(request, obj=None) Return True if the given request has permission to change the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the `obj` model instance. If `obj` is None, this should return True if the given request has permission to change *any* object of the given type. .. py:method:: has_delete_permission(request, obj=None) Return True if the given request has permission to delete the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the `obj` model instance. If `obj` is None, this should return True if the given request has permission to delete *any* object of the given type. .. py:class:: RegionAdmin(model, admin_site) Bases: :py:obj:`oioioi.base.admin.ModelAdmin` Encapsulate all admin options and functionality for a given model. .. py:attribute:: list_display :annotation: = ['short_name', 'name', 'region_server'] .. py:attribute:: fields :annotation: = ['short_name', 'name', 'region_server'] .. py:attribute:: form .. py:method:: has_add_permission(request) Return True if the given request has permission to add an object. Can be overridden by the user in subclasses. .. py:method:: has_change_permission(request, obj=None) Return True if the given request has permission to change the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the `obj` model instance. If `obj` is None, this should return True if the given request has permission to change *any* object of the given type. .. py:method:: has_delete_permission(request, obj=None) Return True if the given request has permission to delete the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the `obj` model instance. If `obj` is None, this should return True if the given request has permission to delete *any* object of the given type. .. py:method:: get_queryset(request) Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view. .. py:method:: save_model(request, obj, form, change) Given a model instance save it to the database. .. py:method:: get_form(request, obj=None, **kwargs) Return a Form class for use in the admin add view. This is used by add_view and change_view. .. py:class:: OnsiteRegistrationInline(parent_model, admin_site) Bases: :py:obj:`oioioi.base.admin.TabularInline` Options for inline editing of ``model`` instances. Provide ``fk_name`` to specify the attribute name of the ``ForeignKey`` from ``model`` to its parent. This is required if ``model`` has more than one ``ForeignKey`` to its parent. .. py:attribute:: model .. py:attribute:: fk_name :annotation: = participant .. py:attribute:: can_delete :annotation: = False .. py:method:: has_add_permission(request, obj=None) Return True if the given request has permission to add an object. Can be overridden by the user in subclasses. .. py:method:: has_change_permission(request, obj=None) Return True if the given request has permission to change the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the `obj` model instance. If `obj` is None, this should return True if the given request has permission to change *any* object of the given type. .. py:method:: formfield_for_foreignkey(db_field, request, **kwargs) Get a form Field for a ForeignKey. .. py:class:: RegionFilter(field, request, *args, **kwargs) Bases: :py:obj:`django.contrib.admin.RelatedFieldListFilter` .. py:class:: OnsiteRegistrationParticipantAdmin(model, admin_site) Bases: :py:obj:`ParticipantAdmin` Encapsulate all admin options and functionality for a given model. .. py:attribute:: list_display .. py:attribute:: inlines .. py:attribute:: list_filter .. py:attribute:: ordering :annotation: = ['participants_onsiteregistration__number'] .. py:attribute:: search_fields .. py:attribute:: admin_order_field :annotation: = participants_onsiteregistration__number .. py:attribute:: admin_order_field :annotation: = participants_onsiteregistration__region .. py:attribute:: admin_order_field :annotation: = participants_onsiteregistration__local_number .. py:method:: get_custom_list_select_related() Returns a list of fields passed to queryset.select_related By default - empty list. Override this method (instead of get_queryset()) to pass another field to the select_related. .. py:method:: number(instance) .. py:method:: region(instance) .. py:method:: local_number(instance) .. py:class:: RegionListFilter(request, params, model, model_admin) Bases: :py:obj:`django.contrib.admin.SimpleListFilter` .. py:attribute:: title .. py:attribute:: parameter_name :annotation: = region .. py:method:: lookups(request, model_admin) Must be overridden to return a list of tuples (value, verbose value) .. py:method:: queryset(request, queryset) Return the filtered queryset. .. py:class:: OnsiteSubmissionAdminMixin(*args, **kwargs) Bases: :py:obj:`object` Adds :class:`~oioioi.participants.admin.RegionListFilter` filter to an admin panel. .. py:method:: get_list_filter(request) .. py:class:: UserWithParticipantsAdminMixin(*args, **kwargs) Bases: :py:obj:`object` Adds :class:`~oioioi.participants.models.Participant` to an admin panel. .. py:class:: ParticipantsRoundTimeExtensionMixin Bases: :py:obj:`object` Adds contest participants to an admin panel. .. py:method:: formfield_for_foreignkey(db_field, request, **kwargs) .. py:class:: TermsAcceptedPhraseInline(parent_model, admin_site) Bases: :py:obj:`oioioi.base.admin.StackedInline` Options for inline editing of ``model`` instances. Provide ``fk_name`` to specify the attribute name of the ``ForeignKey`` from ``model`` to its parent. This is required if ``model`` has more than one ``ForeignKey`` to its parent. .. py:attribute:: model .. py:attribute:: can_delete :annotation: = False .. py:attribute:: form .. py:attribute:: max_num :annotation: = 0 .. py:attribute:: category .. py:method:: has_add_permission(request, obj=None) Return True if the given request has permission to add an object. Can be overridden by the user in subclasses. .. py:method:: has_change_permission(request, obj=None) Return True if the given request has permission to change the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the `obj` model instance. If `obj` is None, this should return True if the given request has permission to change *any* object of the given type. .. py:method:: has_delete_permission(request, obj=None) Return True if the given request has permission to delete the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the `obj` model instance. If `obj` is None, this should return True if the given request has permission to delete *any* object of the given type. .. py:method:: get_readonly_fields(request, obj=None) Hook for specifying custom readonly fields. .. py:class:: TermsAcceptedPhraseAdminMixin(*args, **kwargs) Bases: :py:obj:`object` Adds :class:`~oioioi.participants.models.TermsAcceptedPhrase` to an admin panel.