From da112211e5950130c0871d71dcf8151473a61d7c Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 14 Nov 2024 16:11:01 +1100 Subject: [PATCH] Format number (#8482) * Add extra options for 'format_number' helper * Update documentation * Improved typing hints and docs cleanup * Fix link --- docs/docs/extend/machines/overview.md | 2 +- docs/docs/report/helpers.md | 135 +++++++++++++++--- docs/docs/report/templates.md | 2 +- .../InvenTree/InvenTree/helpers_model.py | 13 +- .../InvenTree/report/templatetags/__init__.py | 0 .../InvenTree/report/templatetags/report.py | 107 ++++++++------ src/backend/InvenTree/report/tests.py | 12 ++ 7 files changed, 193 insertions(+), 78 deletions(-) create mode 100644 src/backend/InvenTree/report/templatetags/__init__.py diff --git a/docs/docs/extend/machines/overview.md b/docs/docs/extend/machines/overview.md index f132903cd3..1ec4cc26be 100644 --- a/docs/docs/extend/machines/overview.md +++ b/docs/docs/extend/machines/overview.md @@ -7,7 +7,7 @@ title: Machines InvenTree has a builtin machine registry. There are different machine types available where each type can have different drivers. Drivers and even custom machine types can be provided by plugins. !!! info "Requires Redis" - If the machines features is used in production setup using workers, a shared [redis cache](../../start/docker.md#redis-cache) is required to function properly. + If the machines features is used in production setup using workers, a shared [redis cache](../../start/processes.md#cache-server) is required to function properly. ### Registry diff --git a/docs/docs/report/helpers.md b/docs/docs/report/helpers.md index 6dc90fb7a6..125d021016 100644 --- a/docs/docs/report/helpers.md +++ b/docs/docs/report/helpers.md @@ -41,6 +41,13 @@ A number of helper functions are available for accessing data contained in a par To return the element at a given index in a container which supports indexed access (such as a [list](https://www.w3schools.com/python/python_lists.asp)), use the `getindex` function: +::: report.templatetags.report.getindex + options: + show_docstring_description: false + show_source: False + +#### Example + ```html {% raw %} {% getindex my_list 1 as value %} @@ -53,6 +60,13 @@ Item: {{ value }} To return an element corresponding to a certain key in a container which supports key access (such as a [dictionary](https://www.w3schools.com/python/python_dictionaries.asp)), use the `getkey` function: +::: report.templatetags.report.getkey + options: + show_docstring_description: false + show_source: False + +#### Example + ```html {% raw %}