From d0cf2b7f81984c7e52ee4e45b2a8b9a588049f53 Mon Sep 17 00:00:00 2001 From: LeandroRoberto Date: Sat, 15 Oct 2016 14:06:05 -0300 Subject: [PATCH] Customiza layout do drf docs. --- sapl/templates/rest_framework_docs/base.html | 81 ++++++++++++ sapl/templates/rest_framework_docs/home.html | 123 +++++++++++++++++++ sapl/utils.py | 1 - 3 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 sapl/templates/rest_framework_docs/base.html create mode 100644 sapl/templates/rest_framework_docs/home.html diff --git a/sapl/templates/rest_framework_docs/base.html b/sapl/templates/rest_framework_docs/base.html new file mode 100644 index 000000000..6614ea4e5 --- /dev/null +++ b/sapl/templates/rest_framework_docs/base.html @@ -0,0 +1,81 @@ +{% load static from staticfiles %} + + + + + + + + + {% block title %}DRF Docs{% endblock %} + + {% block style %} + + {% endblock %} + + + + {% block github_badge %} + + + + + + + + {% endblock %} + +
+ + + + {% block jumbotron %} +
+

DRF Docs

+

Document Web APIs made with Django REST Framework.

+
+ {% endblock %} + + {% block content %}{% endblock %} + + {% block footer %} + + {% endblock %} +
+ + + + + diff --git a/sapl/templates/rest_framework_docs/home.html b/sapl/templates/rest_framework_docs/home.html new file mode 100644 index 000000000..c36e2a904 --- /dev/null +++ b/sapl/templates/rest_framework_docs/home.html @@ -0,0 +1,123 @@ +{% extends "rest_framework_docs/docs.html" %} + +{% block style %}{{block.super}} + +{% endblock %} +{% block logo %} + DRF Docs - SAPL - Sistema de Apoio ao Processo Legislativo +{% endblock %} +{% block title %}SAPL - Sistema de Apoio ao Processo Legislativo{% endblock %} +{% block jumbotron %} +
+

SAPL

+

Sistema de Apoio ao Processo Legislativo.

+
+{% endblock %} + + +{% block apps_menu %} +{% regroup endpoints by name_parent as endpoints_grouped %} + +{% endblock %} + + +{% block content %} + + {% regroup endpoints by name_parent as endpoints_grouped %} + + {% if endpoints_grouped %} + {% for group in endpoints_grouped %} + +

{{group.grouper}}

+ +
+ + {% for endpoint in group.list %} + +
+ + + +
+
+ {% if endpoint.docstring %} +
{{ endpoint.docstring}}
+ {% endif %} + + {% if endpoint.errors %} + + {% endif %} + + {% if endpoint.fields %} +

Fields:

+
    + {% for field in endpoint.fields %} +
  • {{ field.name }}: {{ field.type }} {% if field.required %}R{% endif %}
  • + {% endfor %} +
+ {% elif not endpoint.errors %} +

No fields.

+ {% endif %} +
+
+
+ {% endfor %} + +
+ + {% endfor %} + {% elif not query %} +

There are currently no api endpoints to document.

+ {% else %} +

No endpoints found for {{ query }}.

+ {% endif %} + + + + +{% endblock %} diff --git a/sapl/utils.py b/sapl/utils.py index bd2f53e84..7029a508b 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -18,7 +18,6 @@ from django.core.exceptions import PermissionDenied, ValidationError from django.utils.translation import ugettext_lazy as _ from floppyforms import ClearableFileInput from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row -<<<<<<< 2783b194c573b2b8182c47369b2d251ae6cf8880 import magic from sapl.settings import BASE_DIR