oioioi.contests.admin

Module Contents

Classes

ContestProxyAdminSite

An AdminSite object encapsulates an instance of the Django admin application, ready

RoundInline

Options for inline editing of model instances.

AttachmentInline

Options for inline editing of model instances.

ContestLinkInline

Options for inline editing of model instances.

ContestAdmin

Encapsulate all admin options and functionality for a given model.

BaseContestAdmin

Encapsulate all admin options and functionality for a given model.

ProblemInstanceAdmin

Encapsulate all admin options and functionality for a given model.

ProblemFilter

ContestsProblemNameListFilter

SubmissionKindListFilter

SubmissionRoundListFilter

ContestListFilter

SystemErrorListFilter

SubmissionAdmin

Encapsulate all admin options and functionality for a given model.

RoundTimeRoundListFilter

RoundTimeExtensionAdmin

Encapsulate all admin options and functionality for a given model.

ContestPermissionAdminForm

The main implementation of all the Form logic. Note that this class is

ContestPermissionAdmin

Encapsulate all admin options and functionality for a given model.

Attributes

class oioioi.contests.admin.ContestProxyAdminSite(orig)[source]

Bases: oioioi.base.admin.AdminSite

An AdminSite object encapsulates an instance of the Django admin application, ready to be hooked in to your URLconf. Models are registered with the AdminSite using the register() method, and the get_urls() method can then be used to access Django view functions that present a full admin interface for the collection of registered models.

register(model_or_iterable, admin_class=None, **options)[source]

Register the given model(s) with the given admin class.

The model(s) should be Model classes, not instances.

If an admin class isn’t given, use ModelAdmin (the default admin options). If keyword arguments are given – e.g., list_display – apply them as options to the admin class.

If a model is already registered, raise AlreadyRegistered.

If a model is abstract, raise ImproperlyConfigured.

unregister(model_or_iterable)[source]

Unregister the given model(s).

If a model isn’t already registered, raise NotRegistered.

contest_register(model_or_iterable, admin_class=None, **options)[source]
contest_unregister(model_or_iterable)[source]
get_urls()[source]
index(request, extra_context=None)[source]

Display the main admin index page, which lists all of the installed apps that have been registered in this site.

app_index(request, app_label, extra_context=None)[source]
oioioi.contests.admin.contest_site[source]
class oioioi.contests.admin.RoundInline(parent_model, admin_site)[source]

Bases: 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.

model[source]
extra = 0[source]
inline_classes = ['collapse open'][source]
category[source]
has_add_permission(request, obj=None)[source]

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_change_permission(request, obj=None)[source]

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.

has_delete_permission(request, obj=None)[source]

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.

get_fieldsets(request, obj=None)[source]

Hook for specifying fieldsets.

class oioioi.contests.admin.AttachmentInline(parent_model, admin_site)[source]

Bases: 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.

model[source]
extra = 0[source]
readonly_fields = ['content_link'][source]
category[source]
short_description[source]
has_add_permission(request, obj=None)[source]

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_change_permission(request, obj=None)[source]

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.

has_delete_permission(request, obj=None)[source]

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.

formfield_for_foreignkey(db_field, request, **kwargs)[source]

Get a form Field for a ForeignKey.

class oioioi.contests.admin.ContestLinkInline(parent_model, admin_site)[source]

Bases: 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.

model[source]
extra = 0[source]
category[source]
class oioioi.contests.admin.ContestAdmin(model, admin_site)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

inlines[source]
readonly_fields = ['creation_date'][source]
prepopulated_fields[source]
list_display = ['name', 'id', 'creation_date'][source]
ordering = ['-creation_date'][source]
has_add_permission(request)[source]

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_change_permission(request, obj=None)[source]

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.

get_fields(request, obj=None)[source]

Hook for specifying fields.

get_fieldsets(request, obj=None)[source]

Hook for specifying fieldsets.

get_readonly_fields(request, obj=None)[source]

Hook for specifying custom readonly fields.

get_prepopulated_fields(request, obj=None)[source]

Hook for specifying custom prepopulated fields.

get_form(request, obj=None, **kwargs)[source]

Return a Form class for use in the admin add view. This is used by add_view and change_view.

get_formsets(request, obj=None)[source]
response_change(request, obj)[source]

Determine the HttpResponse for the change_view stage.

response_add(request, obj, post_url_continue=None)[source]

Determine the HttpResponse for the add_view stage.

response_delete(request)[source]

Determine the HttpResponse for the delete_view stage.

_get_extra_context(extra_context)[source]
add_view(request, form_url='', extra_context=None)[source]
change_view(request, object_id, form_url='', extra_context=None)[source]
delete_selected_contests(modeladmin, request, queryset)[source]
get_actions(request)[source]

Return a dictionary mapping the names of all actions for this ModelAdmin to a tuple of (callable, name, description) for each action.

class oioioi.contests.admin.BaseContestAdmin(*args, **kwargs)[source]

Bases: oioioi.base.admin.MixinsAdmin

Encapsulate all admin options and functionality for a given model.

default_model_admin[source]
_mixins_for_instance(request, instance=None)[source]
class oioioi.contests.admin.ProblemInstanceAdmin(*args, **kwargs)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

form[source]
fields = ['contest', 'round', 'problem', 'short_name', 'submissions_limit'][source]
list_display = ['name_link', 'short_name_link', 'round', 'package', 'actions_field'][source]
readonly_fields = ['contest', 'problem'][source]
ordering = ['-round__start_date', 'short_name'][source]
short_description[source]
short_description[source]
admin_order_field = ordering_name[source]
short_description[source]
admin_order_field = short_name[source]
short_description[source]
has_add_permission(request)[source]

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_change_permission(request, obj=None)[source]

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.

has_delete_permission(request, obj=None)[source]

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.

_problem_change_href(instance)[source]
_rejudge_all_submissions_for_problem_href(instance)[source]
_set_needs_rejudge_to_false_href(instance)[source]
_model_solutions_href(instance)[source]
_problem_site_href(instance)[source]
_reset_limits_href(instance)[source]
_reattach_problem_href(instance)[source]
_add_or_update_href(instance)[source]
_replace_statement_href(instance)[source]
_package_manage_href(instance)[source]
_edit_quiz_href(instance)[source]
_move_href(instance)[source]
get_list_display(request)[source]

Return a sequence containing the fields to be displayed on the changelist.

inline_actions(instance)[source]
actions_field(instance)[source]
package(instance)[source]
get_actions(request)[source]

Return a dictionary mapping the names of all actions for this ModelAdmin to a tuple of (callable, name, description) for each action.

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.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

class oioioi.contests.admin.ProblemFilter(field, request, params, model, model_admin, field_path)[source]

Bases: django.contrib.admin.AllValuesFieldListFilter

title[source]
class oioioi.contests.admin.ContestsProblemNameListFilter(request, params, model, model_admin)[source]

Bases: oioioi.base.utils.filters.ProblemNameListFilter

initial_query_manager[source]
contest_field[source]
related_names = problem_instance__problem__names[source]
legacy_name_field[source]
outer_ref[source]
class oioioi.contests.admin.SubmissionKindListFilter(request, params, model, model_admin)[source]

Bases: django.contrib.admin.SimpleListFilter

title[source]
parameter_name = kind[source]
lookups(request, model_admin)[source]

Must be overridden to return a list of tuples (value, verbose value)

queryset(request, queryset)[source]

Return the filtered queryset.

class oioioi.contests.admin.SubmissionRoundListFilter(request, params, model, model_admin)[source]

Bases: django.contrib.admin.SimpleListFilter

title[source]
parameter_name = round[source]
lookups(request, model_admin)[source]

Must be overridden to return a list of tuples (value, verbose value)

queryset(request, queryset)[source]

Return the filtered queryset.

class oioioi.contests.admin.ContestListFilter(request, params, model, model_admin)[source]

Bases: django.contrib.admin.SimpleListFilter

title[source]
parameter_name = contest[source]
lookups(request, model_admin)[source]

Must be overridden to return a list of tuples (value, verbose value)

queryset(request, queryset)[source]

Return the filtered queryset.

class oioioi.contests.admin.SystemErrorListFilter(request, params, model, model_admin)[source]

Bases: django.contrib.admin.SimpleListFilter

title[source]
parameter_name = has_active_system_error[source]
lookups(request, model_admin)[source]

Must be overridden to return a list of tuples (value, verbose value)

queryset(request, queryset)[source]

Return the filtered queryset.

class oioioi.contests.admin.SubmissionAdmin(model, admin_site)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

class Media[source]
js = ['admin/js/jquery.init.js', 'js/admin-filter-collapse.js'][source]
date_hierarchy = date[source]
actions = ['rejudge_action'][source]
search_fields = ['user__username', 'user__last_name', 'problem_instance__problem__legacy_name',...[source]
short_description[source]
admin_order_field = user__username[source]
short_description[source]
admin_order_field = user__last_name[source]
short_description[source]
admin_order_field = problem_instance[source]
short_description[source]
admin_order_field = status[source]
short_description[source]
admin_order_field = score_with_nulls_smallest[source]
short_description[source]
admin_order_field = problem_instance__contest[source]
short_description[source]
get_list_display(request)[source]

Return a sequence containing the fields to be displayed on the changelist.

Return a sequence containing the fields to be displayed as links on the changelist. The list_display parameter is the list of fields returned by get_list_display().

get_list_filter(request)[source]

Return a sequence containing the fields to be displayed as filters in the right sidebar of the changelist page.

get_urls()[source]
get_search_results(request, queryset, search_term)[source]

Return a tuple containing a queryset to implement the search and a boolean indicating if the results may contain duplicates.

rejudge_view(request)[source]
has_add_permission(request)[source]

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_change_permission(request, obj=None)[source]

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.

has_delete_permission(request, obj=None)[source]

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.

has_rejudge_permission(request)[source]
get_actions(request)[source]

Return a dictionary mapping the names of all actions for this ModelAdmin to a tuple of (callable, name, description) for each action.

user_login(instance)[source]
user_full_name(instance)[source]
problem_instance_display(instance)[source]
status_display(instance)[source]
score_display(instance)[source]
contest_display(instance)[source]
rejudge_action(request, queryset)[source]

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.

get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

lookup_allowed(key, value)[source]
change_view(request, object_id, form_url='', extra_context=None)[source]
class oioioi.contests.admin.RoundTimeRoundListFilter(request, params, model, model_admin)[source]

Bases: django.contrib.admin.SimpleListFilter

title[source]
parameter_name = round[source]
lookups(request, model_admin)[source]

Must be overridden to return a list of tuples (value, verbose value)

queryset(request, queryset)[source]

Return the filtered queryset.

class oioioi.contests.admin.RoundTimeExtensionAdmin(model, admin_site)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

list_display = ['user_login', 'user_full_name', 'round', 'extra_time'][source]
list_filter[source]
search_fields = ['user__username', 'user__last_name'][source]
short_description[source]
admin_order_field = user__username[source]
short_description[source]
admin_order_field = user__last_name[source]
has_add_permission(request)[source]

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_change_permission(request, obj=None)[source]

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.

has_delete_permission(request, obj=None)[source]

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.

user_login(instance)[source]
user_full_name(instance)[source]
get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

formfield_for_foreignkey(db_field, request, **kwargs)[source]

Get a form Field for a ForeignKey.

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.

class oioioi.contests.admin.ContestPermissionAdminForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.ModelForm

The main implementation of all the Form logic. Note that this class is different than Form. See the comments by the Form class for more info. Any improvements to the form API should be made to this class, not to the Form class.

class Meta[source]

Bases: object

model[source]
fields = ['user', 'contest', 'permission'][source]
user[source]
class oioioi.contests.admin.ContestPermissionAdmin(model, admin_site)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

list_display = ['permission', 'user', 'user_full_name'][source]
ordering = ['permission', 'user'][source]
form[source]
short_description[source]
admin_order_field = user__last_name[source]
user_full_name(instance)[source]
get_queryset(request)[source]

Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.

formfield_for_foreignkey(db_field, request, **kwargs)[source]

Get a form Field for a ForeignKey.