initial implementation as described in #1463

This commit is contained in:
Matthias 2021-04-15 14:51:11 +02:00
parent 623d0366fc
commit d49977bed3
4 changed files with 24 additions and 2 deletions

View File

@ -19,6 +19,14 @@ def inventreeInstanceName():
return common.models.InvenTreeSetting.get_setting("INVENTREE_INSTANCE", "")
def inventreeInstanceTitle():
""" Returns the InstanceTitle for the current database """
if common.models.InvenTreeSetting.get_setting("INVENTREE_INSTANCE_TITLE", False):
return common.models.InvenTreeSetting.get_setting("INVENTREE_INSTANCE", "")
else:
return 'InvenTree'
def inventreeVersion():
""" Returns the InvenTree version string """
return INVENTREE_SW_VERSION

View File

@ -58,6 +58,13 @@ class InvenTreeSetting(models.Model):
'description': _('String descriptor for the server instance'),
},
'INVENTREE_INSTANCE_TITLE': {
'name': _('Use Instance Name'),
'description': _('Use the instance name in the Titel-Bar'),
'validator': bool,
'default': False,
},
'INVENTREE_COMPANY_NAME': {
'name': _('Company name'),
'description': _('Internal company name'),

View File

@ -71,6 +71,12 @@ def inventree_instance_name(*args, **kwargs):
return version.inventreeInstanceName()
@register.simple_tag()
def inventree_title(*args, **kwargs):
""" Return the title for the current instance - respecting the settings """
return version.inventreeInstanceTitle()
@register.simple_tag()
def inventree_version(*args, **kwargs):
""" Return InvenTree version string """

View File

@ -2,12 +2,13 @@
{% load i18n %}
{% load static %}
{% load inventree_extras %}
{% block page_title %}
InvenTree | {% trans "Index" %}
{% inventree_title %} | {% trans "Index" %}
{% endblock %}
{% block content %}
<h3>InvenTree</h3>
<h3>{% inventree_title %} </h3>
<hr>
<div class='col-sm-3' id='item-panel'>