使用模型表单工厂来简化
#views.py
from django.forms import modelform_factory
def show(request):
author_form = modelform_factory(Author, exclude=['id'])
return render(request, 'show_author.html', {'author_form':author_form})
支持的属性与ModelForm元数据中支持的数据基本一致,例如widgets, help_texts, labels等