'Populate the contex with the requested attributes to trigger the changeform'

def _get_editable_context(self, context, instance, language, edit_fields, view_method, view_url, querystring, editmode=True):

    request = context['request']
    if hasattr(request, 'toolbar'):
        lang = request.toolbar.toolbar_language
    else:
        lang = get_language()
    opts = instance._meta
    if getattr(instance, '_deferred', False):
        opts = opts.proxy_for_model._meta
    with force_language(lang):
        extra_context = {}
        if (edit_fields == 'changelist'):
            instance.get_plugin_name = (u'%s    %s    list' % (smart_text(_('Edit')), smart_text(opts.verbose_name)))
            extra_context['attribute_name'] = 'changelist'
        elif editmode:
            instance.get_plugin_name = (u'%s    %s' % (smart_text(_('Edit')), smart_text(opts.verbose_name)))
            if (not context.get('attribute_name', None)):
                extra_context['attribute_name'] = ('-'.join(edit_fields) if (not isinstance('edit_fields', six.string_types)) else edit_fields)
        else:
            instance.get_plugin_name = (u'%s    %s' % (smart_text(_('Add')), smart_text(opts.verbose_name)))
            extra_context['attribute_name'] = 'add'
        extra_context['instance'] = instance
        extra_context['generic'] = opts
        if view_method:
            method = getattr(instance, view_method)
            if callable(method):
                url_base = method(context['request'])
            else:
                url_base = method
        elif (not editmode):
            view_url = ('admin:%s_%s_add' % (opts.app_label, opts.model_name))
            url_base = reverse(view_url)
        elif (not edit_fields):
            if (not view_url):
                view_url = ('admin:%s_%s_change' % (opts.app_label, opts.model_name))
            if isinstance(instance, Page):
                url_base = reverse(view_url, args=(instance.pk, language))
            else:
                url_base = reverse(view_url, args=(instance.pk,))
        else:
            if (not view_url):
                view_url = ('admin:%s_%s_edit_field' % (opts.app_label, opts.model_name))
            if view_url.endswith('_changelist'):
                url_base = reverse(view_url)
            else:
                url_base = reverse(view_url, args=(instance.pk, language))
            querystring['edit_fields'] = ','.join(context['edit_fields'])
        if editmode:
            extra_context['edit_url'] = ('%s?%s' % (url_base, urlencode(querystring)))
        else:
            extra_context['edit_url'] = ('%s' % url_base)
        extra_context['refresh_page'] = True
        if getattr(context['request'], 'current_page', None):
            extra_context['redirect_on_close'] = context['request'].current_page.get_absolute_url(language)
        else:
            extra_context['redirect_on_close'] = ''
    return extra_context
