def create_model_form_data(model, model_customizer):

    model_form_data = model_to_data(
        model,
        exclude=["tree_id", "lft", "rght", "level", "parent", ],  # ignore mptt fields
        include={
            "last_modified": time.strftime("%c"),
            "loaded": False,
        }
    )
    # model_form_data = get_initial_data(model,{
    #     "last_modified" : time.strftime("%c"),
    #     #"parent" : model.parent,
    # })

    return model_form_data
def create_scientific_property_form_data(model, scientific_property, scientific_property_customizer=None):

    scientific_property_form_data = model_to_data(
        scientific_property,
        exclude=["model", ],  # no need to pass model, since this is handled by virtue of being an "inline" formset
        include={
            "last_modified": time.strftime("%c"),
            "loaded": False,
        }
    )

    if scientific_property_customizer:

        if scientific_property_customizer.field_type == "ENUMERATION":
            # enumeration fields...
            value_field_name = "enumeration_value"
            is_multi = scientific_property_customizer.enumeration_multi
            current_enumeration_value = scientific_property_form_data[value_field_name]
            default_enumeration_value = scientific_property_customizer.enumeration_default
            if current_enumeration_value:
                if is_multi:
                    scientific_property_form_data[value_field_name] = current_enumeration_value.split("|")
                else:
                    scientific_property_form_data[value_field_name] = current_enumeration_value
            elif default_enumeration_value:
                if is_multi:
                    scientific_property_form_data[value_field_name] = default_enumeration_value
                else:
                    scientific_property_form_data[value_field_name] = default_enumeration_value

        else:
            # atomic fields...
            value_field_name = "atomic_value"
            if scientific_property_customizer.atomic_default:
                scientific_property_form_data[value_field_name] = scientific_property_customizer.atomic_default

    return scientific_property_form_data