File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,21 @@ class ViewInspector(object):
263
263
Provide subclass for per-view schema generation
264
264
"""
265
265
def __get__ (self , instance , owner ):
266
+ """
267
+ Enables `ViewInspector` as a Python _Descriptor_.
268
+
269
+ This is how `view.schema` knows about `view`.
270
+
271
+ `__get__` is called when the descriptor is accessed on the owner.
272
+ (That will be when view.schema is called in our case.)
273
+
274
+ `owner` is always the owner class. (An APIView, or subclass for us.)
275
+ `instance` is the view instance or `None` if accessed from the class,
276
+ rather than an instance.
277
+
278
+ See: https://docs.python.org/3/howto/descriptor.html for info on
279
+ descriptor usage.
280
+ """
266
281
self .view = instance
267
282
return self
268
283
You can’t perform that action at this time.
0 commit comments