:py:mod:`oioioi.forum.admin` ============================ .. py:module:: oioioi.forum.admin Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: oioioi.forum.admin.ForumAdmin oioioi.forum.admin.CategoryAdmin oioioi.forum.admin.ThreadAdmin oioioi.forum.admin.PostAdmin oioioi.forum.admin.BanAdmin Functions ~~~~~~~~~ .. autoapisummary:: oioioi.forum.admin.string_concat oioioi.forum.admin.make_list_elem oioioi.forum.admin.get_permission .. py:function:: string_concat(*strings) https://docs.djangoproject.com/en/3.2/releases/1.11/#deprecated-features-1-11 .. py:function:: make_list_elem(elem, text=None) .. py:function:: get_permission(self, request) .. py:class:: ForumAdmin(model, admin_site) Bases: :py:obj:`oioioi.base.admin.ModelAdmin` Encapsulate all admin options and functionality for a given model. .. py:attribute:: fields :annotation: = ['visible', 'lock_date', 'unlock_date', 'categories', 'add_category', 'posts_admin', 'bans'] .. py:attribute:: readonly_fields :annotation: = ['categories', 'add_category', 'posts_admin', 'bans'] .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: short_description .. py:method:: categories(obj) .. py:method:: add_category(obj) .. py:method:: posts_admin(obj) .. py:method:: bans(obj) .. 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_change_permission(request, obj=None) 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. .. 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:: response_change(request, obj) Determine the HttpResponse for the change_view stage. .. py:method:: get_queryset(request) Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view. .. py:class:: CategoryAdmin(model, admin_site) Bases: :py:obj:`oioioi.base.admin.ModelAdmin` Encapsulate all admin options and functionality for a given model. .. py:attribute:: fields :annotation: = ['name', 'threads'] .. py:attribute:: readonly_fields :annotation: = ['threads'] .. py:attribute:: short_description .. py:method:: threads(obj) .. py:method:: save_model(request, obj, form, change) Given a model instance save it to the database. .. 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_change_permission(request, obj=None) 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. .. 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:: response_add(request, obj, post_url_continue=None) Determine the HttpResponse for the add_view stage. .. py:method:: response_change(request, obj) Determine the HttpResponse for the change_view stage. .. py:method:: response_delete(request) Determine the HttpResponse for the delete_view stage. .. py:method:: get_queryset(request) Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view. .. py:class:: ThreadAdmin(model, admin_site) Bases: :py:obj:`oioioi.base.admin.ModelAdmin` Encapsulate all admin options and functionality for a given model. .. py:attribute:: fields :annotation: = ['name', 'category', 'count_posts', 'count_reported', 'posts'] .. py:attribute:: readonly_fields :annotation: = ['count_posts', 'count_reported', 'posts'] .. py:attribute:: short_description .. py:method:: get_post_descr(post) .. py:method:: posts(obj) .. 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_change_permission(request, obj=None) 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. .. 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:: response_add(request, obj, post_url_continue=None) Determine the HttpResponse for the add_view stage. .. py:method:: response_change(request, obj) Determine the HttpResponse for the change_view stage. .. py:method:: response_delete(request) Determine the HttpResponse for the delete_view stage. .. py:method:: formfield_for_foreignkey(db_field, request, **kwargs) Get a form Field for a ForeignKey. .. py:method:: get_queryset(request) Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view. .. py:class:: PostAdmin(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: = ['id', 'author', 'thread_link', 'content', 'reported', 'approved', 'hidden'] .. py:attribute:: list_display_links :annotation: = ['id', 'reported', 'approved', 'hidden'] .. py:attribute:: list_filter :annotation: = ['reported', 'approved', 'hidden', 'thread'] .. py:attribute:: actions :annotation: = ['hide_action', 'unreport_action', 'approve_action', 'revoke_approval_action'] .. py:attribute:: fields :annotation: = ['content', 'thread', 'author', 'reported', 'approved', 'hidden'] .. py:attribute:: readonly_fields :annotation: = ['author'] .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: short_description .. py:attribute:: short_description .. py:method:: thread_link(obj) .. 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_change_permission(request, obj=None) 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. .. 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:: response_change(request, obj) Determine the HttpResponse for the change_view stage. .. py:method:: response_delete(request) Determine the HttpResponse for the delete_view stage. .. py:method:: formfield_for_foreignkey(db_field, request, **kwargs) Get a form Field for a ForeignKey. .. py:method:: hide_action(request, queryset) .. py:method:: unreport_action(request, queryset) .. py:method:: approve_action(request, queryset) .. py:method:: revoke_approval_action(request, queryset) .. py:method:: get_queryset(request) Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view. .. py:class:: BanAdmin(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: = ['user', 'admin', 'created_at'] .. py:attribute:: fields :annotation: = ['user', 'admin', 'created_at', 'reason'] .. py:attribute:: readonly_fields :annotation: = ['user', 'admin', 'created_at'] .. 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_change_permission(request, obj=None) 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. .. 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_queryset(request) Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.