Fork me on GitHub

Django:QuerySet object has no attribute _meta

一.问题

QuerySet object has no attribute _meta

二.原因

filter() returns a QuerySet also if only one object if found. If you want to return just a model instance, use get()

edit_content = models.Wikistore.objects.filter(id=edit_id)
form = EditorTestForm(instance=edit_content)

# 将filter改为get即可。
支持,让我的文章更加优秀!