show token for token auth on browseable api page

This commit is contained in:
Ben Holloway 2013-09-17 23:22:58 +00:00
parent 42a2a5ef87
commit d1802b0a9f

View File

@ -70,6 +70,7 @@
<!-- Content --> <!-- Content -->
<div id="content"> <div id="content">
{% if 'GET' in allowed_methods %} {% if 'GET' in allowed_methods %}
<form id="get-form" class="pull-right"> <form id="get-form" class="pull-right">
<fieldset> <fieldset>
@ -111,6 +112,17 @@
<div class="content-main"> <div class="content-main">
<div class="page-header"><h1>{{ name }}</h1></div> <div class="page-header"><h1>{{ name }}</h1></div>
{{ description }} {{ description }}
{% if user.auth_token.key %}
<input class="input-xxlarge" type="text" value="{{ user.auth_token.key}}" name="key" size="40" onclick="this.select()" />
<label class="help-inline" for="key">API Key</label>
<span class="help-block">
To use Token Authentication append the token into a GET variable named "token" or add
to the Authentization header as shown below:
</span>
<pre class="prettyprint">Authorization: Token {{ user.auth_token.key }}</pre>
{% endif %}
<div class="request-info" style="clear: both" > <div class="request-info" style="clear: both" >
<pre class="prettyprint"><b>{{ request.method }}</b> {{ request.get_full_path }}</pre> <pre class="prettyprint"><b>{{ request.method }}</b> {{ request.get_full_path }}</pre>
</div> </div>