Want to customize the django rest framework Browsa

2019-07-09 20:31发布

问题:

[Issue] I want to customize the django rest framework Browsable API page to have the same look and feel as the rest of my web application.

[Installed Software] Python 3.6 django 1.10.6 django rest framework 3.6.2 markdown 2.6.8

[What I have tried] I have tried to follow the instructions in the link: http://www.django-rest-framework.org/topics/browsable-api/

However, I seem to be missing some key things. I created my own template as per the instructions, but the it didnt indicate how I can actually call the template. I came across this article: http://www.django-rest-framework.org/topics/html-and-forms/

Here I can see where I define the renderer class and I can explicitly call the template I created. The problem is I am getting a reverse error on rest_framework. In the login.html file I simply have:

{% extends "rest_framework/login_base.html" %}

{% block branding %}
    <h3 style="margin: 0 0 20px;">Some New Title</h3>
{% endblock %}