2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-06 20:11:37 +00:00

Render filter options as a template

- This allows the values to be seen by the translation layer
- Also means that whenever a new option is added, it will be automatically available to the front-end!
This commit is contained in:
Oliver Walters
2020-04-11 13:24:23 +10:00
parent 57c5d6c97a
commit c1b59eeaab
5 changed files with 78 additions and 46 deletions

View File

@@ -7,10 +7,22 @@ from InvenTree import version
from InvenTree.helpers import decimal2string
from common.models import InvenTreeSetting
from InvenTree.status_codes import OrderStatus, StockStatus, BuildStatus
register = template.Library()
@register.simple_tag(takes_context=True)
def load_status_codes(context):
context['order_status_codes'] = OrderStatus.list()
context['stock_status_codes'] = StockStatus.list()
context['build_status_codes'] = BuildStatus.list()
# Need to return something as the result is rendered to the page
return ''
@register.simple_tag()
def decimal(x, *args, **kwargs):
""" Simplified rendering of a decimal number """