@handle_response_format
@treeio_login_required
def dashboard_widget_edit(request, widget_id, response_format='html'):

    user = request.user.profile

    widget_object = get_object_or_404(Widget, pk=widget_id)
    if widget_object.user == user:
        perspective = user.get_perspective()
        module = perspective.get_modules().filter(
            name=widget_object.module_name)[0]
        widget = _get_widget(request, module, widget_object.widget_name)
        widget_object.widget = widget
        if 'view' in widget:
            try:
                content = unicode(
                    widget['view'](request, response_format=response_format).content, 'utf_8')
                widget_content = _get_widget_content(
                    content, response_format=response_format)
            except Exception:
                widget_content = ""
            widget['content'] = widget_content
        if request.POST:
            form = WidgetForm(user, request.POST, instance=widget_object)
            if form.is_valid():
                form.save()
                return HttpResponseRedirect(reverse('core_dashboard_index'))
        else:
            form = WidgetForm(user, instance=widget_object)
        return render_to_response('core/dashboard/widget_edit',
                                  {'widget': widget_object,
                                   'form': form},
                                  context_instance=RequestContext(request), response_format=response_format)

    return HttpResponseRedirect(reverse('home'))
Possibly flush the file, writing a bookmark if doing so.
dataset/ETHPy150Open treeio/treeio/treeio/core/dashboard/views.py/dashboard_widget_edit--crossover with--dataset/ETHPy150Open nandhp/python-imdb/imdb/chunkedfile.py/ChunkedFile.bookmark