mirror of
https://github.com/Labelbase/Labelbase.git
synced 2026-08-18 13:09:04 +02:00
.
This commit is contained in:
parent
993efe4d97
commit
71e1f81eb6
2 changed files with 33 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ from labelbase import api
|
|||
from .views import (
|
||||
ExampleSecretView, LabelbaseView, HomeView, RegistrationCompleteView, RegistrationView
|
||||
)
|
||||
|
||||
from django.views.generic import TemplateView
|
||||
from userprofile.views import ProfileView
|
||||
"""
|
||||
from django.urls import path
|
||||
|
|
@ -28,6 +28,10 @@ urlpatterns = format_suffix_patterns(urlpatterns)
|
|||
urlpatterns = [
|
||||
|
||||
path('api/v1/labelbase/<int:labelbase_id>/label/<int:id>/', api.label),
|
||||
path('swagger-ui/', TemplateView.as_view(
|
||||
template_name='swagger-ui.html',
|
||||
extra_context={'schema_url':'openapi-schema'}
|
||||
), name='swagger-ui'),
|
||||
|
||||
path(
|
||||
'',
|
||||
|
|
|
|||
28
templates/swagger-ui.html
Normal file
28
templates/swagger-ui.html
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Swagger</title>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" type="text/css" href="//unpkg.com/swagger-ui-dist@3/swagger-ui.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
<script src="//unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script>
|
||||
<script>
|
||||
const ui = SwaggerUIBundle({
|
||||
url: "{% url schema_url %}",
|
||||
dom_id: '#swagger-ui',
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIBundle.SwaggerUIStandalonePreset
|
||||
],
|
||||
layout: "BaseLayout",
|
||||
requestInterceptor: (request) => {
|
||||
request.headers['X-CSRFToken'] = "{{ csrf_token }}"
|
||||
return request;
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue