:py:mod:`oioioi.programs.admin` =============================== .. py:module:: oioioi.programs.admin Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.programs.admin.ProgramsConfigInline oioioi.programs.admin.ValidationFormset oioioi.programs.admin.TestInline oioioi.programs.admin.ReportActionsConfigInline oioioi.programs.admin.OutputCheckerInline oioioi.programs.admin.LibraryProblemDataInline oioioi.programs.admin.ProblemCompilerInline oioioi.programs.admin.ProblemAllowedLanguageInline oioioi.programs.admin.ContestCompilerInline oioioi.programs.admin.ProgramsContestAdminMixin oioioi.programs.admin.LibraryProblemDataAdminMixin oioioi.programs.admin.ProgrammingProblemAdminMixin oioioi.programs.admin.ProgrammingProblemInstanceAdminMixin oioioi.programs.admin.ProgrammingMainProblemInstanceAdminMixin oioioi.programs.admin.ProblemPackageAdminMixin oioioi.programs.admin.ModelSubmissionAdminMixin oioioi.programs.admin.ProgramSubmissionAdminMixin oioioi.programs.admin.LanguageListFilter .. py:class:: ProgramsConfigInline(parent_model, admin_site) Bases: :py:obj:`django.contrib.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:: can_delete :annotation: = False .. 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:: has_view_permission(request, obj=None) Return True if the given request has permission to view the given Django model instance. The default implementation doesn't examine the `obj` parameter. If overridden by the user in subclasses, it should return True if the given request has permission to view the `obj` model instance. If `obj` is None, it should return True if the request has permission to view any object of the given type. .. py:class:: ValidationFormset(data=None, files=None, instance=None, save_as_new=False, prefix=None, queryset=None, **kwargs) Bases: :py:obj:`django.forms.models.BaseInlineFormSet` A formset for child objects related to a parent. .. py:method:: get_time_limit_sum() .. py:method:: validate_max_scores_in_group() .. py:method:: validate_time_limit_sum() .. py:method:: clean() Hook for doing any extra formset-wide cleaning after Form.clean() has been called on every form. Any ValidationError raised by this method will not be associated with a particular form; it will be accessible via formset.non_form_errors() .. py:class:: TestInline(parent_model, admin_site) Bases: :py:obj:`django.contrib.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:: max_num :annotation: = 0 .. py:attribute:: extra :annotation: = 0 .. py:attribute:: template :annotation: = programs/admin/tests_inline.html .. py:attribute:: can_delete :annotation: = False .. py:attribute:: fields :annotation: = ['name', 'time_limit', 'memory_limit', 'max_score', 'kind', 'input_file_link',... .. py:attribute:: readonly_fields :annotation: = ['name', 'kind', 'group', 'input_file_link', 'output_file_link'] .. py:attribute:: ordering :annotation: = ['kind', 'order', 'name'] .. py:attribute:: formset .. py:attribute:: short_description .. py:attribute:: short_description .. 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:: has_view_permission(request, obj=None) Return True if the given request has permission to view the given Django model instance. The default implementation doesn't examine the `obj` parameter. If overridden by the user in subclasses, it should return True if the given request has permission to view the `obj` model instance. If `obj` is None, it should return True if the request has permission to view any object of the given type. .. py:method:: input_file_link(instance) .. py:method:: output_file_link(instance) .. py:class:: ReportActionsConfigInline(parent_model, admin_site) Bases: :py:obj:`django.contrib.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:: extra :annotation: = 0 .. py:attribute:: inline_classes :annotation: = ['collapse open'] .. py:attribute:: fields :annotation: = ['can_user_generate_outs'] .. 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:: has_view_permission(request, obj=None) Return True if the given request has permission to view the given Django model instance. The default implementation doesn't examine the `obj` parameter. If overridden by the user in subclasses, it should return True if the given request has permission to view the `obj` model instance. If `obj` is None, it should return True if the request has permission to view any object of the given type. .. py:class:: OutputCheckerInline(parent_model, admin_site) Bases: :py:obj:`django.contrib.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:: fields :annotation: = ['checker_link'] .. py:attribute:: readonly_fields :annotation: = ['checker_link'] .. py:attribute:: can_delete :annotation: = False .. py:attribute:: category .. py:attribute:: short_description .. 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:: has_view_permission(request, obj=None) Return True if the given request has permission to view the given Django model instance. The default implementation doesn't examine the `obj` parameter. If overridden by the user in subclasses, it should return True if the given request has permission to view the `obj` model instance. If `obj` is None, it should return True if the request has permission to view any object of the given type. .. py:method:: checker_link(instance) .. py:class:: LibraryProblemDataInline(parent_model, admin_site) Bases: :py:obj:`django.contrib.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:: fields :annotation: = ['libname'] .. py:attribute:: readonly_fields :annotation: = ['libname'] .. py:attribute:: can_delete :annotation: = False .. 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:: has_view_permission(request, obj=None) Return True if the given request has permission to view the given Django model instance. The default implementation doesn't examine the `obj` parameter. If overridden by the user in subclasses, it should return True if the given request has permission to view the `obj` model instance. If `obj` is None, it should return True if the request has permission to view any object of the given type. .. py:class:: ProblemCompilerInline(parent_model, admin_site) Bases: :py:obj:`django.contrib.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:: extra :annotation: = 0 .. py:attribute:: form .. py:attribute:: category .. py:class:: ProblemAllowedLanguageInline(parent_model, admin_site) Bases: :py:obj:`django.contrib.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:: extra :annotation: = 0 .. py:attribute:: form .. py:attribute:: category .. py:class:: ContestCompilerInline(*args, **kwargs) Bases: :py:obj:`django.contrib.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:: extra :annotation: = 0 .. py:attribute:: form .. 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:: has_view_permission(request, obj=None) Return True if the given request has permission to view the given Django model instance. The default implementation doesn't examine the `obj` parameter. If overridden by the user in subclasses, it should return True if the given request has permission to view the `obj` model instance. If `obj` is None, it should return True if the request has permission to view any object of the given type. .. py:class:: ProgramsContestAdminMixin(*args, **kwargs) Bases: :py:obj:`object` Adds :class:`~oioioi.programs.models.ProgramsConfig` and :class:`~oioioi.programs.models.ContestCompiler` to an admin panel. .. py:class:: LibraryProblemDataAdminMixin(*args, **kwargs) Bases: :py:obj:`object` Adds :class:`~oioioi.programs.models.LibraryProblemData` to an admin panel. .. py:class:: ProgrammingProblemAdminMixin(*args, **kwargs) Bases: :py:obj:`object` Adds :class:`~oioioi.programs.models.ReportActionsConfig`, :class:`~oioioi.programs.models.OutputChecker`, :class:`~oioioi.programs.models.LibraryProblemData` and :class:`~oioioi.programs.models.ProblemAllowedLanguage` and :class:`~oioioi.programs.models.ProblemCompiler` to an admin panel. .. py:class:: ProgrammingProblemInstanceAdminMixin(*args, **kwargs) Bases: :py:obj:`object` Adds :class:`~oioioi.programs.models.Test` to an admin panel. .. py:class:: ProgrammingMainProblemInstanceAdminMixin(*args, **kwargs) Bases: :py:obj:`object` Adds :class:`~oioioi.programs.models.Test` to an admin panel. .. py:class:: ProblemPackageAdminMixin Bases: :py:obj:`object` Adds model solutions action to an admin panel. .. py:method:: inline_actions(package_instance, contest) .. py:class:: ModelSubmissionAdminMixin Bases: :py:obj:`object` Adds model submission to an admin panel. .. py:attribute:: short_description .. py:attribute:: admin_order_field .. py:method:: user_full_name(instance) .. py:method:: get_custom_list_select_related() .. py:class:: ProgramSubmissionAdminMixin(*args, **kwargs) Bases: :py:obj:`object` Adds submission diff action, language display and language filter to an admin panel. .. py:attribute:: short_description .. py:attribute:: short_description .. py:method:: get_list_display(request) .. py:method:: get_list_filter(request) .. py:method:: language_display(instance) .. py:method:: submission_diff_action(request, queryset) .. py:class:: LanguageListFilter(request, params, model, model_admin) Bases: :py:obj:`django.contrib.admin.SimpleListFilter` .. py:attribute:: title .. py:attribute:: parameter_name :annotation: = lang .. 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.