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
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
extra = 0
inline_classes = ('collapse open',)
category
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
extra = 0
readonly_fields = ['content_link']
category
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
extra = 0
category
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
readonly_fields = ['creation_date']
prepopulated_fields
list_display = ['name', 'id', 'creation_date']
ordering = ['-creation_date']
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_inlines(request, obj)[source]

Hook for specifying custom inlines.

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]
render_change_form(request, context, add=False, change=False, form_url='', obj=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
_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
fields = ('contest', 'round', 'problem', 'short_name', 'submissions_limit')
list_display = ('name_link', 'short_name_link', 'round', 'package', 'actions_field')
readonly_fields = ('contest', 'problem')
ordering = ('-round__start_date', 'short_name')
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_view_permission(request, obj=None)[source]

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.

_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.

changelist_view(request, extra_context=None)[source]

The ‘change list’ admin view for this model.

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

Bases: django.contrib.admin.AllValuesFieldListFilter

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

Bases: oioioi.base.utils.filters.ProblemNameListFilter

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

Bases: django.contrib.admin.SimpleListFilter

title
parameter_name = 'kind'
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
parameter_name = 'round'
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
parameter_name = 'contest'
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
parameter_name = 'has_active_system_error'
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')
date_hierarchy = 'date'
actions = ['rejudge_action']
search_fields = ['user__username', 'user__last_name', 'problem_instance__problem__legacy_name',...
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]
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
parameter_name = 'round'
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']
list_filter
search_fields = ['user__username', 'user__last_name']
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_view_permission(request, obj=None)[source]

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.

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
fields = ('user', 'contest', 'permission')
user
class oioioi.contests.admin.ContestPermissionAdmin(model, admin_site)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

ordering = ['permission', 'user']
form
user_full_name(instance)[source]
get_list_display(request)[source]

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

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.

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.

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

Get a form Field for a database Field that has declared choices.