drf-yasg/drf_swagger/templates/drf-swagger/redoc.html

44 lines
1.3 KiB
HTML

{% load static %}
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
margin: 0;
padding: 0;
}
{% if not request.version %}
span.api-info-version {
display: none;
}
{% endif %}
</style>
</head>
<body>
<script>
var currentPath = window.location.protocol + "//" + window.location.host + window.location.pathname;
var specURL = currentPath + '?format=openapi';
var redoc = document.createElement("redoc");
redoc.setAttribute("spec-url", specURL);
var redocSettings = {};
redocSettings = {{ redoc_settings | safe }};
if (redocSettings.lazyRendering) {
redoc.setAttribute("lazy-rendering", '');
}
if (redocSettings.pathInMiddle) {
redoc.setAttribute("path-in-middle-panel", '');
}
if (redocSettings.hideHostname) {
redoc.setAttribute("hide-hostname", '');
}
redoc.setAttribute("expand-responses", redocSettings.expandResponses);
document.body.appendChild(redoc);
</script>
<script src="{% static 'drf-swagger/redoc/redoc.min.js' %}"> </script>
</body>
</html>