django_sorcery.utils module

Some common utilities.

django_sorcery.utils.get_args(func)[source]

Returns the names of the positional arguments for composite model inspection.

django_sorcery.utils.lower(value)[source]

Convert value to lowercase if possible.

For example:

>>> print(lower('HELLO'))
hello
>>> print(lower(5))
5
django_sorcery.utils.make_args(*args, **kwargs)[source]

Useful for setting table args and mapper args on models and other things.

django_sorcery.utils.sanitize_separators(value)[source]

Sanitize a value according to the current decimal and thousand separator setting.

Used with form field input.

django_sorcery.utils.setdefaultattr(obj, name, value)[source]

setdefault for object attributes.