Answer the question
In order to leave comments, you need to log in
How to see the class to which the method belongs?
In general, I want to figure out how janga works when it calls CBV, what classes it refers to, what it requests and I want to display the "class -> method / attribute" list, I
try to do this
def __getattribute__(self, *args, **kwargs):
(string,) = args
if ('__class__' != string):
print(self.__class__.__name__, ' ', *args)
return super().__getattribute__(*args, **kwargs)
def __getattribute__(self, *args, **kwargs):
(string,) = args
if '__class__' != string:
from inspect import isfunction
if hasattr(self.__class__, string):
if isfunction(getattr(self.__class__, string)):
print(getattr(self.__class__, string).__qualname__, ' ', *args, **kwargs)
return super().__getattribute__(*args, **kwargs)
Answer the question
In order to leave comments, you need to log in
When I dealt with CBV, I used this site . There is very clearly all the links and code can be traced.
Is it not fate to look at the source codes?
https://github.com/django/django/tree/master/djang...
In views, everything is as simple as two fingers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question