Skip to content

Support viewsets #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Apr 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ title: "Changelog"
source_filename: "changelog"
---

### Release 0.0.9

- Support for more types of `ROOT_URLCONF`
- Move docs to [MKDocs](http://www.mkdocs.org/)


### Release 0.0.7

- Fix methods in Live API Endpoints (now compatible with Python 2.7)
Expand All @@ -18,7 +24,7 @@ source_filename: "changelog"

### Release 0.0.5

- Support both common types of ROOT_URLCONF
- Support both common types of `ROOT_URLCONF`


### Release 0.0.4
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Finally include the `rest_framework_docs` urls in your `urls.py`:
url(r'^docs/', include('rest_framework_docs.urls')),
]

You can now visit [http://0.0.0.0:/8000/docs/](http://0.0.0.0:/8000/docs/) to view your Web API's docs.
You can now visit [http://0.0.0.0:/8000/docs/](http://0.0.0.0:8000/docs/) to view your Web API's docs.
6 changes: 3 additions & 3 deletions docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ To set DRF docs' settings just include the dictionary below in Django's `setting

### Settings Description

##### HIDDEN
##### HIDE_DOCS
You can use hidden to prevent your docs from showing up in different environments (ie. Show in development, hide in production). To do so you can use environment variables.

REST_FRAMEWORK_DOCS = {
'HIDE_DOCS': os.environ.get('SHOW_DRFDOCS', False)
'HIDE_DOCS': os.environ.get('HIDE_DRFDOCS', False)
}

Then set the value of the environment variable `SHOW_DRFDOCS` for each environment (ie. Use `.env` files)
Then set the value of the environment variable `HIDE_DRFDOCS` for each environment (ie. Use `.env` files)

### List of Settings

Expand Down
19 changes: 3 additions & 16 deletions docs/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,69 +5,58 @@ source_filename: templates
### Create the template file
To edit the template you will have to create a `.html` file to override the original one. Inside your `templates` directory create a directory named `rest_framework_docs` and inside this create the file `docs.html`. You can then extend/override the default template.

{% raw %}
{% extends "rest_framework_docs/base.html" %}
{% endraw %}


### Default Blocks

##### Styles (CSS)

{% raw %}
{% block style %}
<link rel="stylesheet" href="{% static "path/to/custom/css/style.css" %}">
{% endblock %}
{% endraw %}

##### GitHub Badge
To hide the GitHub badge from the page, just override it with an empty block.

{% raw %}{% block github_badge %}{% endblock %}{% endraw %}
{% block github_badge %}{% endblock %}

##### Title

{% raw %}{% block title %}Project Name{% endblock %}{% endraw %}
{% block title %}Project Name{% endblock %}

##### Logo

{% raw %}
{% block logo %}
<a class="navbar-brand" href="http://www.drfdocs.com/">DRF Docs</a>
{% endblock %}
{% endraw %}

##### Jumbotron

{% raw %}
{% block jumbotron %}
<div class="jumbotron">
<h1>Project Title</h1>
<h3>Documentantion of the project 'Example'.</h3>
</div>
{% endblock %}
{% endraw %}

##### Footer

{% raw %}
{% block footer %}
<div class="footer">
<div class="links">
<a href="http://www.iamemmanouil.com"><i class="fa fa-link"></i></a>
<a href="http://www.github.com/ekonstantinidis"><i class="fa fa-github"></i></a>
<a href="http://www.twitter.com/iamemmanouil"><i class="fa fa-twitter"></i></a>
</div>
Copyright © 2015 Emmanouil Konstantinidis.
Copyright © 2016 Emmanouil Konstantinidis.
</div>
{% endblock %}
{% endraw %}


### Complete Example
File location: `templates/rest_framework_docs/docs.html`

{% raw %}
{% extends "rest_framework_docs/base.html" %}

{% block title %}Project Name{% endblock %}
Expand All @@ -81,5 +70,3 @@ File location: `templates/rest_framework_docs/docs.html`
{% endblock %}

{% block footer %}<div class="footer">Copyright © 2016 Project Name.</div>{% endblock %}

{% endraw %}
2 changes: 1 addition & 1 deletion rest_framework_docs/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.7'
__version__ = '0.0.9'
2 changes: 1 addition & 1 deletion tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_index_view_with_endpoints(self):

# Test the login view
self.assertEqual(response.context["endpoints"][0].name_parent, "accounts")
self.assertEqual(response.context["endpoints"][0].allowed_methods, ['POST', 'OPTIONS'])
self.assertEqual(sorted(response.context["endpoints"][0].allowed_methods), sorted(['OPTIONS', 'POST']))
self.assertEqual(response.context["endpoints"][0].path, "/accounts/login/")
self.assertEqual(response.context["endpoints"][0].docstring, "A view that allows users to login providing their username and password.")
self.assertEqual(len(response.context["endpoints"][0].fields), 2)
Expand Down