'Create-buttons/form in summary views, both GET and POST
@param r: the S3Request
@param attr: dictionary of parameters for the method handler'

def _widget_create(self, r, **attr):

    response = current.response
    resource = self.resource
    get_config = resource.get_config
    tablename = resource.tablename
    output = {}
    insertable = get_config('insertable', True)
    if insertable:
        listadd = get_config('listadd', True)
        addbtn = get_config('addbtn', False)
        if listadd:
            self.data = None
            if ((r.http == 'GET') and (not self.record_id)):
                populate = attr.pop('populate', None)
                if callable(populate):
                    try:
                        self.data = populate(r, **attr)
                    except TypeError:
                        self.data = None
                    except:
                        raise
                elif isinstance(populate, dict):
                    self.data = populate
            view = response.view
            s3 = response.s3
            cancel = s3.cancel
            s3.cancel = {'hide': 'list-add', 'show': 'show-add-btn'}
            form = self.create(r, **attr).get('form', None)
            if (form and form.accepted and self.next):
                return {'success': True, 'next': self.next}
            response.view = view
            s3.cancel = cancel
            if (form is not None):
                form_postp = r.resource.get_config('form_postp')
                if form_postp:
                    form_postp(form)
                output['form'] = form
                output['showadd_btn'] = self.crud_button(tablename=tablename, name='label_create', icon='add', _id='show-add-btn')
                addtitle = self.crud_string(tablename, 'label_create')
                output['addtitle'] = addtitle
                if (r.http == 'POST'):
                    script = "$('#list-add').show();$('#show-add-btn').hide()"
                    s3.jquery_ready.append(script)
        elif addbtn:
            add_btn = self.crud_button(tablename=tablename, name='label_create', icon='add', _id='add-btn')
            output['buttons'] = {'add_btn': add_btn}
    view = self._view(r, 'listadd.html')
    output = XML(response.render(view, output))
    return output
