<s> from django . http import Http404 <EOL> from django . views . generic . base import TemplateView <EOL> from rest_framework_docs . api_docs import ApiDocumentation <EOL> from rest_framework_docs . settings import DRFSettings <EOL> class DRFDocsView ( TemplateView ) : <EOL> template_name = "<STR_LIT>" <EOL> def get_context_data ( self , ** kwargs ) : <EOL> settings = DRFSettings ( ) . settings <EOL> if settings [ "<STR_LIT>" ] : <EOL> raise Http404 ( "<STR_LIT>" ) <EOL> context = super ( DRFDocsView , self ) . get_context_data ( ** kwargs ) <EOL> docs = ApiDocumentation ( ) <EOL> endpoints = docs . get_endpoints ( ) <EOL> query = self . request . GET . get ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> if query and endpoints : <EOL> endpoints = [ endpoint for endpoint in endpoints if query in endpoint . path ] <EOL> context [ '<STR_LIT>' ] = query <EOL> context [ '<STR_LIT>' ] = endpoints <EOL> return context </s>
