擅长:python、mysql、java
<p>您似乎配置了错误的应用程序。在</p>
<p>我的项目结构</p>
<pre><code>app
|-settings/
|-forums/
| models.py
| admin.py
|-posts/
| models.py
| admin.py
</code></pre>
<p>所以<strong>帖子/模型.py</strong></p>
^{pr2}$
<p><strong>帖子/管理员py</strong></p>
<pre><code>from .models import Post
class PostInline(GenericTabularInline):
model = Post
</code></pre>
<p><strong>论坛/模型.py</strong></p>
<pre><code>class Forum(models.Model):
# other fields
name = models.CharField(max_length=100)
posts = GenericRelation('posts.Post')
</code></pre>
<p><strong>论坛/管理员py</strong></p>
<pre><code>from .models import Forum
from posts.admin import PostInline
@admin.register(Forum)
class ForumAdmin(admin.ModelAdmin):
inlines = [
PostInline,
]
</code></pre>
<p>每件事都很有魅力。在</p>
<p>我猜你有无限循环,因为试图在错误的应用程序中注册模型</p>