-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented documentation for REST API: /api/docs/
- Loading branch information
Nikita Manovich
committed
Feb 4, 2019
1 parent
2f32ed0
commit 55effe1
Showing
4 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
# Copyright (C) 2018 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
from rest_framework import versioning | ||
|
||
class URLPathVersioning(versioning.URLPathVersioning): | ||
def determine_version(self, request, *args, **kwargs): | ||
# When you try to specify a version (e.g /api/v1/docs) it will generate | ||
# an error inside a template of Rest Framework (reverse of an URL | ||
# without argument). Also when you try don't use version at all it will | ||
# give you an error 'invalid version'. To avoid these problems just | ||
# redefine determine_version for /api/docs/*. | ||
if request.path.startswith('/api/docs/'): | ||
return None | ||
|
||
return super().determine_version(request, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters