File tree 4 files changed +7
-7
lines changed
4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ class DRFSettings(object):
5
5
6
6
def __init__ (self ):
7
7
self .drf_settings = {
8
- "SHOW_DOCS " : self .get_setting ("SHOW_DOCS " ) or True
8
+ "HIDE_DOCS " : self .get_setting ("HIDE_DOCS " ) or False
9
9
}
10
10
11
11
def get_setting (self , name ):
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class DRFDocsView(TemplateView):
10
10
11
11
def get_context_data (self , ** kwargs ):
12
12
settings = DRFSettings ().settings
13
- if not settings ["SHOW_DOCS " ]:
13
+ if not settings ["HIDE_DOCS " ]:
14
14
raise Http404 ("Django Rest Framework Docs are hidden. Check your settings." )
15
15
16
16
context = super (DRFDocsView , self ).get_context_data (** kwargs )
Original file line number Diff line number Diff line change 32
32
ROOT_URLCONF = 'tests.urls'
33
33
34
34
REST_FRAMEWORK_DOCS = {
35
- 'SHOW_DOCS ' : True
35
+ 'HIDE_DOCS ' : False
36
36
}
37
37
38
38
# Static files (CSS, JavaScript, Images)
Original file line number Diff line number Diff line change 6
6
class DRFDocsViewTests (TestCase ):
7
7
8
8
SETTINGS_HIDE_DOCS = {
9
- 'SHOW_DOCS ' : False # Default: True
9
+ 'HIDE_DOCS ' : True # Default: False
10
10
}
11
11
12
12
def setUp (self ):
@@ -16,7 +16,7 @@ def test_settings_module(self):
16
16
17
17
settings = DRFSettings ()
18
18
19
- self .assertEqual (settings .get_setting ("SHOW_DOCS " ), True )
19
+ self .assertEqual (settings .get_setting ("HIDE_DOCS " ), True )
20
20
self .assertEqual (settings .get_setting ("TEST" ), None )
21
21
22
22
def test_index_view_with_endpoints (self ):
@@ -52,8 +52,8 @@ def test_index_search_with_endpoints(self):
52
52
@override_settings (REST_FRAMEWORK_DOCS = SETTINGS_HIDE_DOCS )
53
53
def test_index_view_docs_hidden (self ):
54
54
"""
55
- Should prevent the docs from loading the "SHOW_DOCS " is set
56
- to "False " or undefined under settings
55
+ Should prevent the docs from loading the "HIDE_DOCS " is set
56
+ to "True " or undefined under settings
57
57
"""
58
58
response = self .client .get (reverse ('drfdocs' ))
59
59
You can’t perform that action at this time.
0 commit comments