diff --git a/InvenTree/InvenTree/static/script/inventree/inventree.js b/InvenTree/InvenTree/static/script/inventree/inventree.js index 4b43b342af..1a6fdec47a 100644 --- a/InvenTree/InvenTree/static/script/inventree/inventree.js +++ b/InvenTree/InvenTree/static/script/inventree/inventree.js @@ -12,7 +12,7 @@ function attachClipboard(selector, containerselector, textElement) { return document.getElementById(textElement).textContent; } } else { - text = function() { + text = function(trigger) { var content = trigger.parentElement.parentElement.textContent;return content.trim(); } } @@ -22,7 +22,6 @@ function attachClipboard(selector, containerselector, textElement) { text: text, container: containerselector }); - console.log(cis); } @@ -81,7 +80,6 @@ function inventreeDocReady() { attachClipboard('.clip-btn'); attachClipboard('.clip-btn', 'modal-about'); // modals attachClipboard('.clip-btn-version', 'modal-about', 'about-copy-text'); // version-text - } function isFileTransfer(transfer) { diff --git a/InvenTree/common/views.py b/InvenTree/common/views.py index fa605c2b80..857b6b2c51 100644 --- a/InvenTree/common/views.py +++ b/InvenTree/common/views.py @@ -449,8 +449,8 @@ class FileManagementFormView(MultiStepFormView): if guess: n = list(self.column_selections.values()).count(self.column_selections[col]) - if n > 1: - duplicates.append(col) + if n > 1 and self.column_selections[col] not in duplicates: + duplicates.append(self.column_selections[col]) # Store extra context data self.extra_context_data = { diff --git a/InvenTree/order/templates/order/order_wizard/match_fields.html b/InvenTree/order/templates/order/order_wizard/match_fields.html index 4ff7b6a963..cd81142341 100644 --- a/InvenTree/order/templates/order/order_wizard/match_fields.html +++ b/InvenTree/order/templates/order/order_wizard/match_fields.html @@ -55,7 +55,7 @@ {{ col }} {% for duplicate in duplicates %} - {% if duplicate == col.name %} + {% if duplicate == col.value %} diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py index 2c588a81e5..e8743028a0 100644 --- a/InvenTree/part/templatetags/inventree_extras.py +++ b/InvenTree/part/templatetags/inventree_extras.py @@ -1,8 +1,14 @@ +# -*- coding: utf-8 -*- + """ This module provides template tags for extra functionality over and above the built-in Django tags. """ + import os +from django.utils.translation import ugettext_lazy as _ +from django.conf import settings as djangosettings + from django import template from django.urls import reverse from django.utils.safestring import mark_safe @@ -68,6 +74,26 @@ def part_allocation_count(build, part, *args, **kwargs): return InvenTree.helpers.decimal2string(build.getAllocatedQuantity(part)) +@register.simple_tag() +def inventree_in_debug_mode(*args, **kwargs): + """ Return True if the server is running in DEBUG mode """ + + return djangosettings.DEBUG + + +@register.simple_tag() +def inventree_db_engine(*args, **kwargs): + """ Return the InvenTree database backend e.g. 'postgresql' """ + + db = djangosettings.DATABASES['default'] + + engine = db.get('ENGINE', _('Unknown database')) + + engine = engine.replace('django.db.backends.', '') + + return engine + + @register.simple_tag() def inventree_instance_name(*args, **kwargs): """ Return the InstanceName associated with the current database """ diff --git a/InvenTree/templates/stats.html b/InvenTree/templates/stats.html index eff9c4504f..1598d45d26 100644 --- a/InvenTree/templates/stats.html +++ b/InvenTree/templates/stats.html @@ -13,6 +13,19 @@ {% trans "Instance Name" %} {% inventree_instance_name %} + + + {% trans "Database" %} + {% inventree_db_engine %} + + {% inventree_in_debug_mode as debug_mode %} + {% if debug_mode %} + + + {% trans "Debug Mode" %} + {% trans "Server is running in debug mode" %} + + {% endif %} {% if user.is_staff %}