mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge remote-tracking branch 'inventree/master'
This commit is contained in:
commit
3c345424d6
@ -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) {
|
||||
|
@ -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 = {
|
||||
|
@ -55,7 +55,7 @@
|
||||
<td>
|
||||
{{ col }}
|
||||
{% for duplicate in duplicates %}
|
||||
{% if duplicate == col.name %}
|
||||
{% if duplicate == col.value %}
|
||||
<div class='alert alert-danger alert-block text-center' role='alert' style='padding:2px; margin-top:6px; margin-bottom:2px'>
|
||||
<b>{% trans "Duplicate selection" %}</b>
|
||||
</div>
|
||||
|
@ -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 """
|
||||
|
@ -13,6 +13,19 @@
|
||||
<td>{% trans "Instance Name" %}</td>
|
||||
<td>{% inventree_instance_name %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class='fas fa-database'></span></td>
|
||||
<td>{% trans "Database" %}</td>
|
||||
<td>{% inventree_db_engine %}</td>
|
||||
</tr>
|
||||
{% inventree_in_debug_mode as debug_mode %}
|
||||
{% if debug_mode %}
|
||||
<tr>
|
||||
<td><span class='fas fa-laptop-code'></span></td>
|
||||
<td>{% trans "Debug Mode" %}</td>
|
||||
<td>{% trans "Server is running in debug mode" %}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if user.is_staff %}
|
||||
<tr>
|
||||
<td><span class='fas fa-server'></span></td>
|
||||
|
Loading…
Reference in New Issue
Block a user