Skip to content

Commit 6be868d

Browse files
committed
Abstract out permissions check
This makes it possible to change access to the view by subclassing.
1 parent 54953a0 commit 6be868d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

schema_graph/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010
class Schema(TemplateView):
1111
template_name = "schema_graph/schema.html"
1212

13+
def access_permitted(self):
14+
"""When this returns True, the schema graph page is accessible."""
15+
return settings.DEBUG
16+
1317
def dispatch(self, request):
14-
if not settings.DEBUG:
18+
if not self.access_permitted():
1519
raise Http404()
1620
return super().dispatch(request)
1721

0 commit comments

Comments
 (0)