Example #1
0
        "QUICKAPI_ONLY_AUTHORIZED_USERS": false, 
        "QUICKAPI_DEBUG": false, 
        "QUICKAPI_SWITCH_LANGUAGE_AUTO": true, 
        "QUICKAPI_SWITCH_LANGUAGE": true,
        "QUICKAPI_ENSURE_ASCII": false,
        "QUICKAPI_PYGMENTS_STYLE": "default",
        "QUICKAPI_VERSIONS": {/*%s*/}
    }
}
```
""", (_('String in your localization'), _('versions of components'))),
    footer=_('*In debug mode shows the settings. Here are the default.* <a href="./?method=quickapi.test">Click for test</a>.')
)


METHODS = get_methods() # store default methods from settings


@csrf_exempt
def index(request, methods=METHODS):
    """
    Распределяет запросы либо отдавая страницу документации, либо
    вызывая метод.

    Структура запроса для выполнения метода:

        {
            'method': 'Имя вызываемого метода',
            'kwargs': { Словарь параметров },
            # Необязательные ключи могут браться из сессии, либо из
            # заголовков запроса (например HTTP Basic Authorization).
Example #2
0
    "num_pages": 10,
    "page_range": [1,2,3,'...',9,10],
    "start_index": 1,
    "end_index": 10,
    "has_previous": true,
    "has_next": true,
    "has_other_pages": true,
    "previous_page_number": 1,
    "next_page_number": 3,
}
```
""", (_('The serialized object to the page of Paginator'), _('First object'), _('Second object'))),
    footer=_('*This is the standard output, which can be overridden separately for each report.*')
)


_methods = [
    ('reportapi.get_scheme', API_get_scheme),
    ('reportapi.document_create', API_document_create),
    ('reportapi.document_info', API_document_info),
    ('reportapi.document_delete', API_document_delete),
    ('reportapi.object_search', API_object_search),
]

# store prepared methods
METHODS = get_methods(_methods)

@csrf_exempt
def api(request):
    return quickapi_index(request, methods=METHODS)