

def needs():
    ' RESTful CRUD controller '
    S3SQLInlineComponent = s3base.S3SQLInlineComponent
    crud_fields = ['name', 'location_id']
    cappend = crud_fields.append
    field = s3db.assess_needs_demographic_data.parameter_id
    field.writable = False
    field.comment = None
    table = s3db.stats_demographic
    rows = db((table.deleted != True)).select(table.parameter_id, table.name)
    label = T('Demographics')
    number = 0
    for row in rows:
        name = ('number%s' % number)
        number += 1
        cappend(S3SQLInlineComponent('demographic', name=name, label=label, fields=(('', 'parameter_id'), ('', 'value')), filterby=dict(field='parameter_id', options=row.parameter_id), multiple=False))
        label = ''
    table = s3db.assess_need
    rows = db((table.deleted != True)).select(table.id, table.name)
    label = T('Needs')
    for row in rows:
        name = ('number%s' % number)
        number += 1
        cappend(S3SQLInlineComponent('need', name=name, label=label, fields=(('', 'need_id'), ('', 'value')), filterby=dict(field='need_id', options=row.id), multiple=False))
        label = ''
    crud_form = s3base.S3SQLCustomForm(*crud_fields)
    s3db.configure('assess_needs', crud_form=crud_form)
    return s3_rest_controller()

dataset/ETHPy150Open sahana/eden/controllers/assess.py needs/original