擅长:python、mysql、java
<p>看看文档的<a href="https://docs.djangoproject.com/en/1.8/ref/models/meta/#migrating-from-the-old-api" rel="nofollow">Migrating from the old API</a>部分。它有例子。考虑将<code>MyModel._meta.get_all_related_objects()</code>替换为</p>
<pre><code>[
f for f in MyModel._meta.get_fields()
if (f.one_to_many or f.one_to_one) and f.auto_created
]
</code></pre>