oioioi.disqualification.admin

Module Contents

Classes

DisqualificationAdmin

Encapsulate all admin options and functionality for a given model.

DisqualificationsConfigInline

Options for inline editing of model instances.

DisqualificationsAdminMixin

Adds DisqualificationsConfigInline

class oioioi.disqualification.admin.DisqualificationAdmin(model, admin_site)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

list_display = ['id', 'title', 'submission_link', 'user_full_name', 'guilty_text'][source]
list_filter = ['guilty'][source]
search_fields = ['title', 'user__username', 'user__last_name'][source]
raw_id_fields = ['submission'][source]
exclude = ['contest'][source]
short_description[source]
short_description[source]
admin_order_field = user__last_name[source]
short_description[source]
admin_order_field = guilty[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.

save_model(request, obj, form, change)[source]

Given a model instance save it to the database.

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

Get a form Field for a ForeignKey.

user_full_name(instance)[source]
guilty_text(instance)[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.

class oioioi.disqualification.admin.DisqualificationsConfigInline(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]
category[source]
formfield_overrides[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.

class oioioi.disqualification.admin.DisqualificationsAdminMixin(*args, **kwargs)[source]

Bases: object

Adds DisqualificationsConfigInline to an admin panel.