是否可以手动将字段条目添加到使用通用视图创建的对象中?
例如,
from django.views.generic.create_update import create_object
def create_thing(request):
queryset = Things.objects.all()
#Somehow pass something to tell the view to
#assign Thing.author=request.user...
return create_object(
request,
queryset,
form_class = ThingForm,
template_name = 'thing_template.html',
)
塔!