:py:mod:`oioioi.oi.admin` ========================= .. py:module:: oioioi.oi.admin Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.oi.admin.SchoolAdmin oioioi.oi.admin.OIRegistrationInline oioioi.oi.admin.OIRegistrationParticipantAdmin .. py:class:: SchoolAdmin(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: = ['name', 'participants_link', 'address', 'postal_code_link', 'city', 'province', 'phone',... .. py:attribute:: list_filter :annotation: = ['province', 'city', 'is_approved', 'is_active'] .. py:attribute:: search_fields :annotation: = ['name', 'address', 'postal_code'] .. py:attribute:: actions :annotation: = ['make_active', 'make_inactive', 'approve', 'disapprove', 'merge_action', 'delete_selected'] .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: admin_order_field :annotation: = postal_code .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: short_description .. py:method:: participants_link(instance) .. py:method:: postal_code_link(instance) .. py:method:: similar_schools(instance) .. py:method:: make_active(request, queryset) .. py:method:: make_inactive(request, queryset) .. py:method:: approve(request, queryset) .. py:method:: disapprove(request, queryset) .. py:method:: merge_action(request, queryset) .. py:class:: OIRegistrationInline(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:: fk_name :annotation: = participant .. py:attribute:: form .. py:attribute:: can_delete :annotation: = False .. py:attribute:: inline_classes :annotation: = ['collapse open'] .. py:attribute:: exclude :annotation: = ['terms_accepted'] .. py:class:: OIRegistrationParticipantAdmin(model, admin_site) Bases: :py:obj:`oioioi.participants.admin.ParticipantAdmin` Encapsulate all admin options and functionality for a given model. .. py:attribute:: list_display .. py:attribute:: inlines .. py:attribute:: readonly_fields :annotation: = ['user'] .. py:attribute:: search_fields .. py:attribute:: list_filter .. py:attribute:: short_description .. py:attribute:: admin_order_field :annotation: = oi_oiregistration__school__name .. py:attribute:: admin_order_field :annotation: = oi_oiregistration__school__city .. py:attribute:: admin_order_field :annotation: = oi_oiregistration__school__province .. 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:: school_name(instance) .. py:method:: school_city(instance) .. py:method:: school_province(instance) .. 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_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_actions(request) Return a dictionary mapping the names of all actions for this ModelAdmin to a tuple of (callable, name, description) for each action.