@login_required
def upload(request):
    js = 'js' in request.GET
    if request.method == 'POST':
        form = ImageUploadForm(data=request.POST, files=request.FILES)
        if form.is_valid():
            image = form.save()
            if js:
                return HttpResponse('<script>window.opener.editor.insertImage("[image:%d]");window.close();</script>' % image.id)
            else:
                return redirect(image)
    else:
        form = ImageUploadForm()
    return render(request, 'images/upload.html', {
        'title': 'Upload',
        'form': form,
        'description': "Use this form to upload an image.",
        'action': 'Upload',
        'js': js,
    })
An observer which updates the proxy when the state changes.
dataset/ETHPy150Open 2buntu/2buntu-blog/twobuntu/images/views.py/upload--crossover with--dataset/ETHPy150Open nucleic/enaml/enaml/widgets/timer.py/Timer._update_proxy