管理模型中缺少外键?

lack of foreign key in admin model?

尝试更新数据库时出现以下错误:

class 'artdb.admin.RoleInline': (admin.E202) 'artdb.Role' 没有指向 'artdb.Person'

的外键

我希望 Person 和 Role 之间存在多对多关系

model.py(未显示所有 class):

class Person(models.Model):

    mail=models.EmailField()
    firstName=models.CharField(max_length=200)
    lastName=models.CharField(max_length=200)
    phoneNumber=PhoneNumberField()
    streetAdress=models.CharField(max_length=200)
    zipcode=models.CharField(max_length=200)
    city=models.CharField(max_length=200,default="Göteborg")
    country=models.CharField(max_length=200,default="Sweden")

    def __str__(self):
        return "%s %s" % (self.firstName,self.lastName)

    class Meta:
        ordering = ('firstName','lastName')

class Role(models.Model):

    role=models.CharField(max_length=200)
    person=models.ManyToManyField(Person)

    def __str__(self):
        return self.role

    class Meta:
        ordering = ('role',)

admin.py(未显示所有 classes):

from django.contrib import admin
from .models import Role
from .models import Address
from .models import Date
from .models import Person
from .models import Name

# Register your models here.

admin.site.register(Role)
admin.site.register(Address)
admin.site.register(Date)
admin.site.register(Name)
admin.site.register(Person)

class RoleInline(admin.TabularInline):

    model=Role
    extra=3


class PersonInline(admin.ModelAdmin):

    fieldsets=[
        (None,{'fields': ['mail','firstName','lastName','phoneNumber','streetAdress','zipcode','city','country']}),
    ]
    inlines = [RoleInline]
    search_fields = ['firstName']

#admin.site.register(Name,NameInline)
admin.site.register(Person,PersonInline)

它之前曾与 运行 manage.py makemigrations artdb 一起工作 我没有看到模型中的错误。

根据 ManytoMany relationship in TabularInline

的文档,RoleInline 的模型有误
 model = Role.persons.through