Mixins

CMSSchemaMixin

class headless_cms.mixins.CMSSchemaMixin

Bases: object

Mixin to include views in the OpenAPI schema documentation for the CMS.

This mixin is used to dynamically generate documentation for the OpenAPI schema, ensuring that only views extending this mixin will be included in the generated schema. It also provides default CMS permission classes for Django REST Framework views.

permission_classes

A list of permission classes that includes the default CMS permission class followed by the default permission classes from Django REST Framework settings.

Type:

list

Example

This mixin can be used in a Django REST Framework view to include the view in the OpenAPI schema documentation and enforce CMS-specific permission policies.

from rest_framework.views import APIView
from headless_cms.mixins import CMSSchemaMixin

class MyCMSView(CMSSchemaMixin, APIView):
    # Your view implementation here
    pass
permission_classes = [<class 'rest_framework.permissions.AllowAny'>, <class 'rest_framework.permissions.AllowAny'>]