Skip to content

Commit d1098f0

Browse files
author
Emmanouil Konstantinidis
committed
Merge branch 'master' into pr/47
2 parents e866a41 + c8740b1 commit d1098f0

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

rest_framework_docs/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class DRFSettings(object):
55

66
def __init__(self):
77
self.drf_settings = {
8-
"HIDDEN": self.get_setting("HIDDEN") or False
8+
"HIDE_DOCS": self.get_setting("HIDE_DOCS") or False
99
}
1010

1111
def get_setting(self, name):

rest_framework_docs/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class DRFDocsView(TemplateView):
1010

1111
def get_context_data(self, filter_param=None, **kwargs):
1212
settings = DRFSettings().settings
13-
if settings["HIDDEN"]:
13+
if settings["HIDE_DOCS"]:
1414
raise Http404("Django Rest Framework Docs are hidden. Check your settings.")
1515

1616
context = super(DRFDocsView, self).get_context_data(**kwargs)

tests/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
ROOT_URLCONF = 'tests.urls'
3333

3434
REST_FRAMEWORK_DOCS = {
35-
'HIDDEN': False
35+
'HIDE_DOCS': False
3636
}
3737

3838
# Static files (CSS, JavaScript, Images)

tests/tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class DRFDocsViewTests(TestCase):
77

88
SETTINGS_HIDE_DOCS = {
9-
'HIDDEN': True # Default: False
9+
'HIDE_DOCS': True # Default: False
1010
}
1111

1212
def setUp(self):
@@ -16,7 +16,7 @@ def test_settings_module(self):
1616

1717
settings = DRFSettings()
1818

19-
self.assertEqual(settings.get_setting("HIDDEN"), False)
19+
self.assertEqual(settings.get_setting("HIDE_DOCS"), False)
2020
self.assertEqual(settings.get_setting("TEST"), None)
2121

2222
def test_index_view_with_endpoints(self):
@@ -52,8 +52,8 @@ def test_index_search_with_endpoints(self):
5252
@override_settings(REST_FRAMEWORK_DOCS=SETTINGS_HIDE_DOCS)
5353
def test_index_view_docs_hidden(self):
5454
"""
55-
Should prevent the docs from loading the "HIDDEN" is set
56-
to "False" in settings
55+
Should prevent the docs from loading the "HIDE_DOCS" is set
56+
to "True" or undefined under settings
5757
"""
5858
response = self.client.get(reverse('drfdocs'))
5959

0 commit comments

Comments
 (0)