Python中文
首页
教程
问答
标签
搜索
登录
注册
基本Django定制管理器
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我正在通过<a href="http://www.djangobook.com/en/2.0/chapter10/" rel="nofollow noreferrer">Django book</a>,我现在在<a href="http://www.djangobook.com/en/2.0/chapter10/" rel="nofollow noreferrer">chapter 10</a>。我在理解这段代码的第三行时遇到了问题:</p> <pre><code>class DahlBookManager(models.Manager): def get_query_set(self): return super(DahlBookManager, self).get_query_set().filter(author='Roald Dahl') </code></pre> <p>我知道这个自定义管理器实例正在重写超类<code>get_query_set</code>方法,但是为什么<code>super</code>调用同时传递<code>DahlBookManager</code>和<code>self</code>?<code>self</code>和<code>DahlBookManager</code>不是一回事吗?你知道吗</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>不,<code>self</code>是<code>DahlBookManager</code>的实例。<code>super()</code>使用类来处理诸如MRO、继承等事情</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
将Pandas数据帧转换为PyTorch张量?
6 回答
将Pandas数据帧转换为scipy稀疏矩阵
8 回答
将Pandas数据帧转换为Spark Datafram时出现问题
9 回答
将pandas数据帧转换为spark DataFram时出错
8 回答
将Pandas数据帧转换为spark datafram时收到错误
10 回答
将Pandas数据帧转换为Spark数据帧
6 回答
将Pandas数据帧转换为Tensorflow数据
4 回答
将Pandas数据帧转换为tkinter obj
1 回答
将pandas数据帧转换为XML
5 回答
将Pandas数据帧转换为值sql语句
6 回答
将pandas数据帧转换为元组
7 回答
将pandas数据帧转换为元组列表
4 回答
将pandas数据帧转换为元组列表并删除所有pandas数据类型
2 回答
将pandas数据帧转换为具有头和数据类型的numpy数组
9 回答
将pandas数据帧转换为内存中的拼花地板,并将其加载到Python中的Hadoop中
5 回答
将pandas数据帧转换为内存中类似文件的对象?
8 回答
将Pandas数据帧转换为内存功能(&F)
4 回答
将pandas数据帧转换为列表列表
9 回答
将pandas数据帧转换为列表列表以输入到RNN
3 回答
将Pandas数据帧转换为单行DataFram
9 回答