Converting field names

You may not like the snake case convention widely used in Python to be used in the filtering expressions your user write. Therefore you can use one of the built in case coverters or write your own.

Built in converters

django_nlf.utils.camel_to_snake_case(value: str)str

Converts strings in camelCase to snake_case.

Parameters

value (str) – camalCase value.

Returns

snake_case value.

Return type

str

Custom converter

To support automatic case conversion, a custom implementation can be provided.

# app/utils.py
def my_converter(field_name: str) -> str:
    # do something with field_name
    return field_name

and in settings.py:

NLF_FIELD_NAME_CONVERTER = "app.utils.my_converter"