MCPcopy
hub / github.com/django/django / _get_view_func

Method _get_view_func

django/contrib/admindocs/views.py:173–187  ·  view source on GitHub ↗
(view)

Source from the content-addressed store, hash-verified

171
172 @staticmethod
173 def _get_view_func(view):
174 urlconf = get_urlconf()
175 if get_resolver(urlconf)._is_callback(view):
176 mod, func = get_mod_func(view)
177 try:
178 # Separate the module and function, e.g.
179 # 'mymodule.views.myview' -> 'mymodule.views', 'myview').
180 return getattr(import_module(mod), func)
181 except ImportError:
182 # Import may fail because view contains a class name, e.g.
183 # 'mymodule.views.ViewContainer.my_view', so mod takes the form
184 # 'mymodule.views.ViewContainer'. Parse it again to separate
185 # the module and class.
186 mod, klass = get_mod_func(mod)
187 return getattr(getattr(import_module(mod), klass), func)
188
189 def get_context_data(self, **kwargs):
190 view = self.kwargs["view"]

Callers 1

get_context_dataMethod · 0.95

Calls 4

get_urlconfFunction · 0.90
get_resolverFunction · 0.90
get_mod_funcFunction · 0.90
_is_callbackMethod · 0.80

Tested by

no test coverage detected