Example #1
0
def delete(request, folder_id):

    folder  = Folder.get_by_id(int(folder_id))
    if folder is None:
        raise Http404

    folder.delete()
    rebuild_folders() 
    return redirect('../..')
Example #2
0
def create(request):

    folder = Folder()
    if request.method == 'POST':
        form = FolderForm(request.POST, instance=folder)
        if form.is_valid():
            logging.info('edit folder before %s'% folder)
            form.save(commit=False)
            logging.info('edit folder after %s'% folder)
            folder.save()
            cdbsync.plan_cdb_put(folder)
            rebuild_folders() 
            return redirect('..')
    else:
        form = FolderForm(instance=folder)
    return render_to_response('admin/folders_create.html', RequestContext(request, {'form':form}))
Example #3
0
def edit(request, folder_id):

    folder  = Folder.get_by_id(int(folder_id))
    if folder is None:
        raise Http404

    if request.method == 'POST':
        form = FolderForm(request.POST, instance=folder)
        if form.is_valid():
            logging.info('edit folder before %s'% folder)
            form.save(commit=False)
            logging.info('edit folder after %s'% folder)
            folder.save()
            cdbsync.plan_cdb_put(folder)
            rebuild_folders()
            return redirect('../..')
    else:
        form = FolderForm(instance=folder)

    return render_to_response('admin/folders_edit.html', RequestContext(request, {'form':form}))