Ejemplo n.º 1
0
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))
Ejemplo n.º 2
0
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))