

def form_fields(self):
    '\n        Return fields of default form.\n\n        Fill some fields with reasonable values.\n        '
    fields = dict(self.form.fields)
    for elem in self.form.inputs:
        if (not elem.get('name')):
            continue
        if elem.get('disabled'):
            if (elem.name in fields):
                del fields[elem.name]
        elif (elem.tag == 'select'):
            if (fields[elem.name] is None):
                if len(elem.value_options):
                    fields[elem.name] = elem.value_options[0]
        elif (getattr(elem, 'type', None) == 'radio'):
            if (fields[elem.name] is None):
                fields[elem.name] = elem.get('value')
        elif (getattr(elem, 'type', None) == 'checkbox'):
            if (not elem.checked):
                if (elem.name is not None):
                    if (elem.name in fields):
                        del fields[elem.name]
    return fields

dataset/ETHPy150Open lorien/grab/grab/document.py FormExtension.form_fields/original