A combined :class:`MultiDict` with values from :attr:`forms` and
            :attr:`GET`. File-uploads are not included.
769526
def params(self):
        
        params = MultiDict(self.GET)
        for key, value in self.forms.iterallitems():
            params[key] = value
        return params
393338
def get_post_form_kwargs(self):
        
        kwargs = {
            'user': self.request.user,
            'forum': self.get_forum(),
            'topic': self.get_topic(),
        }

        post = self.get_post()
        if post:
            kwargs.update({'instance': post})

        if self.request.method in ('POST', 'PUT'):
            kwargs.update({
                'data': self.request.POST,
                'files': self.request.FILES,
            })
        return kwargs
1161355
def get_form_errors(form):
    
    return {
        'non_field': form.non_field_errors(),
        'field_specific': OrderedDict(
            (field, form.errors[field.name])
            for field in form
            if field.name in form.errors
        )
    }
814064
def get_form_kwargs(self):
        
        kwargs = {"user": self.request.user, "initial": self.get_initial()}
        if self.request.method in ["POST", "PUT"]:
            kwargs.update({
                "data": self.request.POST,
                "files": self.request.FILES,
            })
        return kwargs
857463
def get_form(self, **kwargs):
        """"""
        if not hasattr(self, "form_class"):
            raise AttributeError(_("You must define a form_class"))
        return self.form_class(**kwargs)
273808
def append_form(
            self,
            obj: Union[Sequence[Tuple[str, str]],
                       Mapping[str, str]],
            headers: Optional['MultiMapping[str]']=None
    ) -> Payload:
        """"""
        assert isinstance(obj, (Sequence, Mapping))

        if headers is None:
            headers = CIMultiDict()

        if isinstance(obj, Mapping):
            obj = list(obj.items())
        data = urlencode(obj, doseq=True)

        return self.append_payload(
            StringPayload(data, headers=headers,
                          content_type='application/x-www-form-urlencoded'))
571913
def parse_multipart_form(body, boundary):
    '''
    '''
    files = RequestParameters()
    fields = RequestParameters()

    form_parts = body.split(boundary)
    for form_part in form_parts[1:-1]:
        file_name = None
        file_type = None
        field_name = None
        line_index = 2
        line_end_index = 0
        while not line_end_index == -1:
            line_end_index = form_part.find(b'\r\n', line_index)
            form_line = form_part[line_index:line_end_index].decode('utf-8')
            line_index = line_end_index + 2

            if not form_line:
                break

            colon_index = form_line.index(':')
            form_header_field = form_line[0:colon_index].lower()
            form_header_value, form_parameters = parse_header(
                form_line[colon_index + 2:])

            if form_header_field == 'content-disposition':
                if 'filename' in form_parameters:
                    file_name = form_parameters['filename']
                field_name = form_parameters.get('name')
            elif form_header_field == 'content-type':
                file_type = form_header_value

        post_data = form_part[line_index:-4]
        if file_name or file_type:
            file = File(type=file_type, name=file_name, body=post_data)
            if field_name in files:
                files[field_name].append(file)
            else:
                files[field_name] = [file]
        else:
            value = post_data.decode('utf-8')
            if field_name in fields:
                fields[field_name].append(value)
            else:
                fields[field_name] = [value]

    return fields, files
685266
def is_form_get(attr, attrs):
    """"""
    res = False
    if attr == "action":
        method = attrs.get_true('method', u'').lower()
        res = method != 'post'
    return res
414193
def get_form(self, request, obj=None, **kwargs):
        
        parent_id = request.GET.get('parent_id', None)
        if not parent_id:
            parent_id = request.POST.get('parent_id', None)
        if parent_id:
            return AddFolderPopupForm
        else:
            folder_form = super(FolderAdmin, self).get_form(
                request, obj=None, **kwargs)

            def folder_form_clean(form_obj):
                cleaned_data = form_obj.cleaned_data
                folders_with_same_name = self.get_queryset(request).filter(
                    parent=form_obj.instance.parent,
                    name=cleaned_data['name'])
                if form_obj.instance.pk:
                    folders_with_same_name = folders_with_same_name.exclude(
                        pk=form_obj.instance.pk)
                if folders_with_same_name.exists():
                    raise ValidationError(
                        'Folder with this name already exists.')
                return cleaned_data

            # attach clean to the default form rather than defining a new form class
            folder_form.clean = folder_form_clean
            return folder_form
202158
def get_form_instance(self, request, data=None, instance=None):
        
        defaults = {}
        if self.form:
            defaults['form'] = self.form
        if self.fields:
            defaults['fields'] = self.fields
        return modelform_factory(self.model, **defaults)(data=data, instance=instance)
178513
def wrap_form_params(func):
    

    @functools.wraps(func)
    def wrapper(request, *args, **kwargs):
        ctype, pdict = parse_header(request.headers.get('Content-Type', ''))
        if ctype == "application/x-www-form-urlencoded":
            params = {}
            for key, value in parse_qs(request.body.decode("utf-8")).items():
                if len(value) == 1:
                    params[key] = value[0]
                else:
                    params[key] = value

            request.params = merge_dicts(getattr(request, "params", None), params)
            request.form_params = params
        return func(request, *args, **kwargs)
    return wrapper
130325
def get_dict(*keys, **extras):
    """"""

    _keys = ('url', 'args', 'form', 'data', 'origin', 'headers', 'files', 'json', 'method')

    assert all(map(_keys.__contains__, keys))
    data = request.data
    form = semiflatten(request.form)

    try:
        _json = json.loads(data.decode('utf-8'))
    except (ValueError, TypeError):
        _json = None

    d = dict(
        url=get_url(request),
        args=semiflatten(request.args),
        form=form,
        data=json_safe(data),
        origin=request.headers.get('X-Forwarded-For', request.remote_addr),
        headers=get_headers(),
        files=get_files(),
        json=_json,
        method=request.method,
    )

    out_d = dict()

    for key in keys:
        out_d[key] = d.get(key)

    out_d.update(extras)

    return out_d
90958
def parse_form(self, req, name, field):
        """"""
        try:
            return core.get_value(req.form, name, field)
        except AttributeError:
            pass
        return core.missing
850038
def get_search_form(self):
        
        magic_dico_form = self.get_dict_for_forms()
        forms = []
        initial = list(self.request.GET.lists())

        for key, value in magic_dico_form.items():
            form = Form()
            model = value["model"]
            if not value["fields"]:
                continue
            for field in value["fields"]:
                formfield = get_formfield(model, field)
                formfield.widget.attrs.update({'class': self.css_class})
                form.fields.update({
                    field : formfield
                })

            initial_tmp = {}
            for k, vals in initial:
                tmp_list = k.split(model.__name__ + "-")
                if len(tmp_list) == 2:
                    list_val_tmp = vals[0] if len(vals) == 1 else [val for val in vals if val != '']
                    initial_tmp[tmp_list[-1]] = list_val_tmp

            form.initial = initial_tmp
            form.prefix = model.__name__
            forms.append(form)
        return sorted(forms, key=lambda form: form.prefix)
1187320
def get_forms(self, *args, **kwargs):
        
        forms = self.find_all(_form_ptn, *args, **kwargs)
        return [
            Form(form)
            for form in forms
        ]
569089
def construct_form(self, request):
        
        if not hasattr(self, 'form_class'):
            return None

        if request.method == 'POST':
            form = self.form_class(self.model, request.POST, request.FILES)
        else:
            form = self.form_class(self.model)
        return form
913897
def get_form_kwargs(self):
        
        kwargs = {
            'initial':  self.get_initial(),
            'prefix':   self.get_prefix(),
        }

        #noinspection PyUnresolvedReferences
        if self.request.method in ('POST', 'PUT'):
            #noinspection PyUnresolvedReferences
            kwargs.update({
                'data':     self.request.POST,
                'files':    self.request.FILES,
            })

        if hasattr(self, 'object'):
            kwargs.update({'instance': self.object})

        return kwargs