是否有可能做这样的事情:
def new_query(request,company_uuid,address_uuid,contact_uuid):
mcompany = get_object_or_404(Company, uuid=company_uuid)
if request.method == 'POST': # If the form has been submitted...
form = forms.CompanyQueryForm(request.POST)
if form.is_valid():
mquery = form.save(commit = False)
mcompany = get_object_or_404(Company, uuid = company_uuid)
mquery.company = mcompany
mquery.version_number = 1
mquery.parameters = {
'company':company_uuid,
'address':address_uuid,
'contact':contact_uuid
}
mquery.save()
preserialise(mquery.pk, company_uuid)
recent_update = RecentUpdate(company_query=mquery, update_type="1")
recent_update.save()
url = reverse('view_directory',kwargs={'company_uuid':company_uuid,
'address_uuid':address_uuid,
'contact_uuid':contact_uuid})
return HttpResponseRedirect(url)
else:
form = forms.CompanyQueryForm()
return share.output_page(request,'joinerysoft/new_query.html',{'title':unicode(u'New Company Query'),
'form': form,
'company':mcompany,
'address_uuid':address_uuid,
'contact_uuid':contact_uuid})
哪里preserialise(mquery.pk, company_uuid)
在后台运行而不等待返回?因为预序列化需要很长时间才能完成(超过 5 分钟),从用户的角度来看,我希望它成为一场火灾并忘记。