# -*- coding: utf-8 -*-
"""
#########################
API Browser Configuration
#########################
API Browser default configuration and a simple helper for fetching settings.
"""
from django.conf import settings
class Templates(object):
API = 'api_browser/api.html'
"""API Browser Default Template
Blocks
------
head
Everything defined in the head section.
title
Title of the page.
author
Page author.
favicon
Path to favicon.
stylesheets
All stylesheets loaded in the head section.
body
Everything defined in the body section
javascript
All javascripts loaded at the end of the body.
js
An extra block the user can override to add their own script tags.
"""
DRF_API = 'api_browser/drf_api.html'
"""Django Rest Framework Browsable API style (slightly modified)."""
ALWAYS_DISPLAY_DOCUMENTATION = True
"""Should API documentation be displayed to anonymous users?"""
TEMPLATE = Templates.API
"""The template used to render the API Browser.
This can be an arbitrary template, or one of the included templates:
- api_browser/api.html
The new API Browser style.
- api_browser/drf_api.html
The original Django Rest Framework browsable API style (slightly modified).
"""
FILTER_TEMPLATE = 'rest_framework/filters/base.html'
"""Template used to filter results???"""
# TODO(nick): What is this actually used for?
FORMAT_SUFFIX = 'docs'
"""The format suffix that the APIBrowserRenderer responds to."""
API_BROWSER = {
'ALWAYS_DISPLAY_DOCUMENTATION': ALWAYS_DISPLAY_DOCUMENTATION,
'TEMPLATE': TEMPLATE,
'FILTER_TEMPLATE': FILTER_TEMPLATE,
'FORMAT_SUFFIX': FORMAT_SUFFIX,
# 'FORM_RENDERER_CLASS': drf_renderers.HTMLFormRenderer,
}
USER_SETTINGS = getattr(settings, 'API_BROWSER', {})
API_BROWSER.update(USER_SETTINGS)
def get(name):
return API_BROWSER.get(name)