简体   繁体   English

是否有一个工具可以查看子类及其从Django / Python中的多个父类继承的所有属性和方法?

[英]Is there a tool to view the child class and all its attributes and methods inherited from multiple parents in Django / Python?

I'm doing battle with Django's Class Based Views and their mixin inheritance at the moment. 目前,我正在与Django的基于类的视图及其混合继承进行斗争。 What would really help me to understand what is going on would be a way to "export" from my child class all its inheritances. 真正可以帮助我了解所发生情况的方法是从子类“继承”其所有继承的一种方法。 What I mean, is a tool that would go through all the parent classes pulling out methods and attributes, overriding as necessary so that I could see the "Frankenstein" class constructed from all of the different parts in one file. 我的意思是,该工具将遍历所有父类,提取出方法和属性,并根据需要进行覆盖,以便我可以在一个文件中看到由所有不同部分构成的“ Frankenstein”类。 I think that would make it easier to work out what is going on. 我认为这样可以更轻松地确定正在发生的事情。 Does anybody know of such a tool? 有人知道这样的工具吗? I use PyCharm by the way if that helps. 如果有帮助,我可以使用PyCharm。

I'm not sure if you're looking for something more customizable to your project, but you can take a look at Classy Django which does what you're looking for with Django's built-in class based views. 我不确定您是否正在寻找更可自定义的项目,但是您可以看看Classy Django ,它可以使用Django的内置基于类的视图来完成您所需要的工作。

If that's not going to cut it, you can always install IPython and explore instances of each class or classes themselves by pressing the tab key to view all members on an instance/class. 如果这不能解决问题,您可以始终安装IPython并通过按Tab键查看实例/类上的所有成员来探索每个类或类本身的实例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM