Example #1
0
def field_function(model, form_field):
    model_object, model, direct, m2m = get_field_by_name(model, form_field.name)
    attrs = {"class": "func_select"}
    options_attrs = {}
    choices = []
    classes = {True: "param", False: "noparam"}
    for label, (__, param, enabler, __) in list(OPERATIONS.get_for_field(model_object).items()):
        options_attrs[label] = {"class": classes[param], "label": label}
        choices.append((label, label))
    return SelectOptionsAttribute(attrs, choices, options_attrs).render("func_id_%s" % form_field.name, "")
Example #2
0
def field_function(model, form_field):
    model_object, model, direct, m2m = model._meta.get_field_by_name(form_field.name)
    attrs = {'class': 'func_select'}
    options_attrs = {}
    choices = []
    classes = {True: 'param', False: 'noparam'}
    for label, (__, param, enabler, __) in OPERATIONS.get_for_field(model_object).items():
        options_attrs[label] = {'class': classes[param], 'label': label}
        choices.append((label, label))
    return SelectOptionsAttribute(attrs, choices, options_attrs).render("func_id_%s" % form_field.name, "")
def field_function(model, form_field):
    model_object, model, direct, m2m = get_field_by_name(
        model, form_field.name)
    attrs = {'class': 'func_select'}
    options_attrs = {}
    choices = []
    classes = {True: 'param', False: 'noparam'}
    for label, (__, param, enabler,
                __) in list(OPERATIONS.get_for_field(model_object).items()):
        options_attrs[label] = {'class': classes[param], 'label': label}
        choices.append((label, label))
    return SelectOptionsAttribute(attrs, choices, options_attrs).render(
        "func_id_%s" % form_field.name, "")