原问题网址:
http://stackoverflow.com/questions/10535604/cannot-assign-must-be-a-instance-django
描述:
Not sure where the confusion here is. Scripter.title
is a foreign key to Book
, so you must give it an actual Book
, not a string.
当前所对应的值的表需要和想要获取过滤后的表有关联,不是随便什么值都可以,最好是A表.objects.filter(foreignkey = foreignkey‘s table.id)