The horizon.utils.functions ModuleΒΆ

horizon.utils.functions.add_logout_reason(request, response, reason)[source]
horizon.utils.functions.bytes_to_gigabytes(bytes)[source]
horizon.utils.functions.format_value(value)[source]

Returns the given value rounded to one decimal place if it is a decimal, or integer if it is an integer.

horizon.utils.functions.get_keys(tuple_of_tuples)[source]

Processes a tuple of 2-element tuples and returns a tuple containing first component of each tuple.

horizon.utils.functions.get_log_length(request, default=35)[source]
horizon.utils.functions.get_page_size(request, default=20)[source]
horizon.utils.functions.lazy_join(*args, **kw)
horizon.utils.functions.logout_with_message(request, msg, redirect=True)[source]

Send HttpResponseRedirect to LOGOUT_URL.

msg is a message displayed on the login page after the logout, to explain the logout reason.

horizon.utils.functions.natural_sort(attr)[source]
horizon.utils.functions.next_key(tuple_of_tuples, key)[source]

Processes a tuple of 2-element tuples and returns the key which comes after the given key.

horizon.utils.functions.previous_key(tuple_of_tuples, key)[source]

Processes a tuple of 2-element tuples and returns the key which comes before the given key.

horizon.utils.functions.value_for_key(tuple_of_tuples, key)[source]

Processes a tuple of 2-element tuples and returns the value corresponding to the given key. If not value is found, the key is returned.

Previous topic

The horizon.utils.units Module

Next topic

The horizon.utils.file_discovery Module

Project Source

This Page