oioioi.forum.admin

Module Contents

Classes

ForumAdmin

Encapsulate all admin options and functionality for a given model.

CategoryAdmin

Encapsulate all admin options and functionality for a given model.

ThreadAdmin

Encapsulate all admin options and functionality for a given model.

PostAdmin

Encapsulate all admin options and functionality for a given model.

BanAdmin

Encapsulate all admin options and functionality for a given model.

Functions

oioioi.forum.admin.string_concat(*strings)[source]

https://docs.djangoproject.com/en/3.2/releases/1.11/#deprecated-features-1-11

oioioi.forum.admin.make_list_elem(elem, text=None)[source]
oioioi.forum.admin.get_permission(self, request)[source]
class oioioi.forum.admin.ForumAdmin(model, admin_site)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

fields = ['visible', 'lock_date', 'unlock_date', 'categories', 'add_category', 'posts_admin', 'bans'][source]
readonly_fields = ['categories', 'add_category', 'posts_admin', 'bans'][source]
short_description[source]
short_description[source]
short_description[source]
short_description[source]
categories(obj)[source]
add_category(obj)[source]
posts_admin(obj)[source]
bans(obj)[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.

response_change(request, obj)[source]

Determine the HttpResponse for the change_view stage.

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.forum.admin.CategoryAdmin(model, admin_site)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

fields = ['name', 'threads'][source]
readonly_fields = ['threads'][source]
short_description[source]
threads(obj)[source]
save_model(request, obj, form, change)[source]

Given a model instance save it to the database.

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.

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

Determine the HttpResponse for the add_view stage.

response_change(request, obj)[source]

Determine the HttpResponse for the change_view stage.

response_delete(request)[source]

Determine the HttpResponse for the delete_view stage.

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.forum.admin.ThreadAdmin(model, admin_site)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

fields = ['name', 'category', 'count_posts', 'count_reported', 'posts'][source]
readonly_fields = ['count_posts', 'count_reported', 'posts'][source]
short_description[source]
get_post_descr(post)[source]
posts(obj)[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.

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

Determine the HttpResponse for the add_view stage.

response_change(request, obj)[source]

Determine the HttpResponse for the change_view stage.

response_delete(request)[source]

Determine the HttpResponse for the delete_view stage.

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

Get a form Field for a ForeignKey.

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.forum.admin.PostAdmin(model, admin_site)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

list_display = ['id', 'author', 'thread_link', 'content', 'reported', 'approved', 'hidden'][source]
list_filter = ['reported', 'approved', 'hidden', 'thread'][source]
actions = ['hide_action', 'unreport_action', 'approve_action', 'revoke_approval_action'][source]
fields = ['content', 'thread', 'author', 'reported', 'approved', 'hidden'][source]
readonly_fields = ['author'][source]
short_description[source]
short_description[source]
short_description[source]
short_description[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.

response_change(request, obj)[source]

Determine the HttpResponse for the change_view stage.

response_delete(request)[source]

Determine the HttpResponse for the delete_view stage.

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

Get a form Field for a ForeignKey.

hide_action(request, queryset)[source]
unreport_action(request, queryset)[source]
approve_action(request, queryset)[source]
revoke_approval_action(request, queryset)[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.

class oioioi.forum.admin.BanAdmin(model, admin_site)[source]

Bases: oioioi.base.admin.ModelAdmin

Encapsulate all admin options and functionality for a given model.

list_display = ['user', 'admin', 'created_at'][source]
fields = ['user', 'admin', 'created_at', 'reason'][source]
readonly_fields = ['user', 'admin', 'created_at'][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.

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.