def clone_document(request, pk): """ Clone a document """ document = Document.objects.get(pk=pk) form = CloneForm() if request.method == 'POST': form = CloneForm(request.POST) if form.is_valid(): document.clone(request.user.username, form.cleaned_data) return HttpResponseRedirect(reverse('documents.views.list_documents')) return render_to_response('clone_document.html', { 'document': document, 'form': form, }, context_instance=RequestContext(request))
def clone_document(request, pk): """ Clone a document """ document = Document.objects.get(pk=pk) form = CloneForm() if request.method == 'POST': form = CloneForm(request.POST) if form.is_valid(): document.clone(request.user.username, form.cleaned_data) return HttpResponseRedirect( reverse('documents.views.list_documents')) return render_to_response('clone_document.html', { 'document': document, 'form': form, }, context_instance=RequestContext(request))