mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #2886 from SchrodingersGat/remove-demo-mode
Remove "demo mode"
This commit is contained in:
commit
5a77156051
@ -150,13 +150,13 @@ class DeleteForm(forms.Form):
|
|||||||
|
|
||||||
|
|
||||||
class EditUserForm(HelperForm):
|
class EditUserForm(HelperForm):
|
||||||
""" Form for editing user information
|
"""
|
||||||
|
Form for editing user information
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
fields = [
|
fields = [
|
||||||
'username',
|
|
||||||
'first_name',
|
'first_name',
|
||||||
'last_name',
|
'last_name',
|
||||||
]
|
]
|
||||||
|
@ -62,12 +62,6 @@ DEBUG = _is_true(get_setting(
|
|||||||
CONFIG.get('debug', True)
|
CONFIG.get('debug', True)
|
||||||
))
|
))
|
||||||
|
|
||||||
# Determine if we are running in "demo mode"
|
|
||||||
DEMO_MODE = _is_true(get_setting(
|
|
||||||
'INVENTREE_DEMO',
|
|
||||||
CONFIG.get('demo', False)
|
|
||||||
))
|
|
||||||
|
|
||||||
DOCKER = _is_true(get_setting(
|
DOCKER = _is_true(get_setting(
|
||||||
'INVENTREE_DOCKER',
|
'INVENTREE_DOCKER',
|
||||||
False
|
False
|
||||||
@ -217,9 +211,6 @@ MEDIA_URL = '/media/'
|
|||||||
if DEBUG:
|
if DEBUG:
|
||||||
logger.info("InvenTree running with DEBUG enabled")
|
logger.info("InvenTree running with DEBUG enabled")
|
||||||
|
|
||||||
if DEMO_MODE:
|
|
||||||
logger.warning("InvenTree running in DEMO mode") # pragma: no cover
|
|
||||||
|
|
||||||
logger.debug(f"MEDIA_ROOT: '{MEDIA_ROOT}'")
|
logger.debug(f"MEDIA_ROOT: '{MEDIA_ROOT}'")
|
||||||
logger.debug(f"STATIC_ROOT: '{STATIC_ROOT}'")
|
logger.debug(f"STATIC_ROOT: '{STATIC_ROOT}'")
|
||||||
|
|
||||||
@ -921,7 +912,7 @@ PLUGIN_TESTING_SETUP = get_setting('PLUGIN_TESTING_SETUP', False) # load plugin
|
|||||||
PLUGIN_RETRY = get_setting('PLUGIN_RETRY', 5) # how often should plugin loading be tried?
|
PLUGIN_RETRY = get_setting('PLUGIN_RETRY', 5) # how often should plugin loading be tried?
|
||||||
PLUGIN_FILE_CHECKED = False # Was the plugin file checked?
|
PLUGIN_FILE_CHECKED = False # Was the plugin file checked?
|
||||||
|
|
||||||
# user interface customization values
|
# User interface customization values
|
||||||
CUSTOMIZE = get_setting(
|
CUSTOMIZE = get_setting(
|
||||||
'INVENTREE_CUSTOMIZE',
|
'INVENTREE_CUSTOMIZE',
|
||||||
CONFIG.get('customize', {}),
|
CONFIG.get('customize', {}),
|
||||||
|
@ -34,8 +34,7 @@ from user_sessions.views import SessionDeleteView, SessionDeleteOtherView
|
|||||||
|
|
||||||
from common.settings import currency_code_default, currency_codes
|
from common.settings import currency_code_default, currency_codes
|
||||||
|
|
||||||
from part.models import Part, PartCategory
|
from part.models import PartCategory
|
||||||
from stock.models import StockLocation, StockItem
|
|
||||||
from common.models import InvenTreeSetting, ColorTheme
|
from common.models import InvenTreeSetting, ColorTheme
|
||||||
from users.models import check_user_role, RuleSet
|
from users.models import check_user_role, RuleSet
|
||||||
|
|
||||||
@ -882,29 +881,6 @@ class DatabaseStatsView(AjaxView):
|
|||||||
ajax_template_name = "stats.html"
|
ajax_template_name = "stats.html"
|
||||||
ajax_form_title = _("System Information")
|
ajax_form_title = _("System Information")
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
|
|
||||||
ctx = {}
|
|
||||||
|
|
||||||
# Part stats
|
|
||||||
ctx['part_count'] = Part.objects.count()
|
|
||||||
ctx['part_cat_count'] = PartCategory.objects.count()
|
|
||||||
|
|
||||||
# Stock stats
|
|
||||||
ctx['stock_item_count'] = StockItem.objects.count()
|
|
||||||
ctx['stock_loc_count'] = StockLocation.objects.count()
|
|
||||||
|
|
||||||
"""
|
|
||||||
TODO: Other ideas for database metrics
|
|
||||||
|
|
||||||
- "Popular" parts (used to make other parts?)
|
|
||||||
- Most ordered part
|
|
||||||
- Most sold part
|
|
||||||
- etc etc etc
|
|
||||||
"""
|
|
||||||
|
|
||||||
return ctx
|
|
||||||
|
|
||||||
|
|
||||||
class NotificationsView(TemplateView):
|
class NotificationsView(TemplateView):
|
||||||
""" View for showing notifications
|
""" View for showing notifications
|
||||||
|
@ -201,3 +201,5 @@ static_root: '/home/inventree/data/static'
|
|||||||
# login_message: InvenTree demo instance - <a href='https://inventree.readthedocs.io/en/latest/demo/'> Click here for login details</a>
|
# login_message: InvenTree demo instance - <a href='https://inventree.readthedocs.io/en/latest/demo/'> Click here for login details</a>
|
||||||
# navbar_message: <h6>InvenTree demo mode <a href='https://inventree.readthedocs.io/en/latest/demo/'><span class='fas fa-info-circle'></span></a></h6>
|
# navbar_message: <h6>InvenTree demo mode <a href='https://inventree.readthedocs.io/en/latest/demo/'><span class='fas fa-info-circle'></span></a></h6>
|
||||||
# logo: logo.png
|
# logo: logo.png
|
||||||
|
# hide_admin_link: true
|
||||||
|
# hide_password_reset: true
|
||||||
|
@ -160,13 +160,6 @@ def inventree_in_debug_mode(*args, **kwargs):
|
|||||||
return djangosettings.DEBUG
|
return djangosettings.DEBUG
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag()
|
|
||||||
def inventree_demo_mode(*args, **kwargs):
|
|
||||||
""" Return True if the server is running in DEMO mode """
|
|
||||||
|
|
||||||
return djangosettings.DEMO_MODE
|
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag()
|
@register.simple_tag()
|
||||||
def inventree_show_about(user, *args, **kwargs):
|
def inventree_show_about(user, *args, **kwargs):
|
||||||
""" Return True if the about modal should be shown """
|
""" Return True if the about modal should be shown """
|
||||||
|
@ -13,15 +13,15 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block actions %}
|
{% block actions %}
|
||||||
{% inventree_demo_mode as demo %}
|
{% inventree_customize 'hide_password_reset' as hide_password_reset %}
|
||||||
{% if not demo %}
|
{% if not hide_password_reset %}
|
||||||
<div class='btn btn-outline-primary' type='button' id='edit-password' title='{% trans "Change Password" %}'>
|
<div class='btn btn-outline-primary' type='button' id='edit-password' title='{% trans "Change Password" %}'>
|
||||||
<span class='fas fa-key'></span> {% trans "Set Password" %}
|
<span class='fas fa-key'></span> {% trans "Set Password" %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class='btn btn-primary' type='button' id='edit-user' title='{% trans "Edit User Information" %}'>
|
<div class='btn btn-primary' type='button' id='edit-user' title='{% trans "Edit User Information" %}'>
|
||||||
<span class='fas fa-user-cog'></span> {% trans "Edit" %}
|
<span class='fas fa-user-cog'></span> {% trans "Edit" %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
{% settings_value 'LOGIN_ENABLE_SSO' as enable_sso %}
|
{% settings_value 'LOGIN_ENABLE_SSO' as enable_sso %}
|
||||||
{% inventree_customize 'login_message' as login_message %}
|
{% inventree_customize 'login_message' as login_message %}
|
||||||
{% mail_configured as mail_conf %}
|
{% mail_configured as mail_conf %}
|
||||||
{% inventree_demo_mode as demo %}
|
|
||||||
|
|
||||||
<h1>{% trans "Sign In" %}</h1>
|
<h1>{% trans "Sign In" %}</h1>
|
||||||
|
|
||||||
@ -37,12 +36,12 @@ for a account and sign in below:{% endblocktrans %}</p>
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
{% if login_message %}
|
{% if login_message %}
|
||||||
<div>{{ login_message }}<hr></div>
|
<div>{{ login_message | safe }}<hr></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="btn-group float-right" role="group">
|
<div class="btn-group float-right" role="group">
|
||||||
<button class="btn btn-success" type="submit">{% trans "Sign In" %}</button>
|
<button class="btn btn-success" type="submit">{% trans "Sign In" %}</button>
|
||||||
</div>
|
</div>
|
||||||
{% if mail_conf and enable_pwd_forgot and not demo %}
|
{% if mail_conf and enable_pwd_forgot %}
|
||||||
<a class="" href="{% url 'account_reset_password' %}"><small>{% trans "Forgot Password?" %}</small></a>
|
<a class="" href="{% url 'account_reset_password' %}"><small>{% trans "Forgot Password?" %}</small></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
{% settings_value "SERVER_RESTART_REQUIRED" as server_restart_required %}
|
{% settings_value "SERVER_RESTART_REQUIRED" as server_restart_required %}
|
||||||
{% settings_value "LABEL_ENABLE" with user=user as labels_enabled %}
|
{% settings_value "LABEL_ENABLE" with user=user as labels_enabled %}
|
||||||
{% inventree_show_about user as show_about %}
|
{% inventree_show_about user as show_about %}
|
||||||
{% inventree_demo_mode as demo_mode %}
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
@ -94,7 +93,7 @@
|
|||||||
{% block alerts %}
|
{% block alerts %}
|
||||||
<div class='notification-area' id='alerts'>
|
<div class='notification-area' id='alerts'>
|
||||||
<!-- Div for displayed alerts -->
|
<!-- Div for displayed alerts -->
|
||||||
{% if server_restart_required and not demo_mode %}
|
{% if server_restart_required %}
|
||||||
<div id='alert-restart-server' class='alert alert-danger' role='alert'>
|
<div id='alert-restart-server' class='alert alert-danger' role='alert'>
|
||||||
<span class='fas fa-server'></span>
|
<span class='fas fa-server'></span>
|
||||||
<strong>{% trans "Server Restart Required" %}</strong>
|
<strong>{% trans "Server Restart Required" %}</strong>
|
||||||
|
@ -6,9 +6,10 @@
|
|||||||
{% settings_value 'BARCODE_ENABLE' as barcodes %}
|
{% settings_value 'BARCODE_ENABLE' as barcodes %}
|
||||||
{% settings_value 'STICKY_HEADER' user=request.user as sticky %}
|
{% settings_value 'STICKY_HEADER' user=request.user as sticky %}
|
||||||
{% navigation_enabled as plugin_nav %}
|
{% navigation_enabled as plugin_nav %}
|
||||||
{% inventree_demo_mode as demo %}
|
|
||||||
{% inventree_show_about user as show_about %}
|
{% inventree_show_about user as show_about %}
|
||||||
{% inventree_customize 'navbar_message' as navbar_message %}
|
{% inventree_customize 'navbar_message' as navbar_message %}
|
||||||
|
{% inventree_customize 'hide_admin_link' as hide_admin_link %}
|
||||||
|
|
||||||
<nav class="navbar {% if sticky %}fixed-top{% endif %} navbar-expand-lg navbar-light">
|
<nav class="navbar {% if sticky %}fixed-top{% endif %} navbar-expand-lg navbar-light">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
@ -89,7 +90,7 @@
|
|||||||
{% if navbar_message %}
|
{% if navbar_message %}
|
||||||
{% include "spacer.html" %}
|
{% include "spacer.html" %}
|
||||||
<div class='flex justify-content-center'>
|
<div class='flex justify-content-center'>
|
||||||
{{ navbar_message }}
|
{{ navbar_message | safe }}
|
||||||
</div>
|
</div>
|
||||||
{% include "spacer.html" %}
|
{% include "spacer.html" %}
|
||||||
{% include "spacer.html" %}
|
{% include "spacer.html" %}
|
||||||
@ -132,7 +133,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<ul class='dropdown-menu dropdown-menu-end inventree-navbar-menu'>
|
<ul class='dropdown-menu dropdown-menu-end inventree-navbar-menu'>
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
{% if user.is_staff and not demo %}
|
{% if user.is_staff and not hide_admin_link %}
|
||||||
<li><a class='dropdown-item' href="{% url 'admin:index' %}"><span class="fas fa-user-shield"></span> {% trans "Admin" %}</a></li>
|
<li><a class='dropdown-item' href="{% url 'admin:index' %}"><span class="fas fa-user-shield"></span> {% trans "Admin" %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li><a class='dropdown-item' href="{% url 'settings' %}"><span class="fas fa-cog"></span> {% trans "Settings" %}</a></li>
|
<li><a class='dropdown-item' href="{% url 'settings' %}"><span class="fas fa-cog"></span> {% trans "Settings" %}</a></li>
|
||||||
|
@ -87,31 +87,4 @@
|
|||||||
<!-- TODO - Enumerate system issues here! -->
|
<!-- TODO - Enumerate system issues here! -->
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td colspan='3'><strong>{% trans "Parts" %}</strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><span class='fas fa-sitemap'></span></td>
|
|
||||||
<td>{% trans "Part Categories" %}</td>
|
|
||||||
<td>{{ part_cat_count }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><span class='fas fa-shapes'></span></td>
|
|
||||||
<td>{% trans "Parts" %}</td>
|
|
||||||
<td>{{ part_count }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3"><strong>{% trans "Stock Items" %}</strong></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><span class='fas fa-map-marker-alt'></span></td>
|
|
||||||
<td>{% trans "Stock Locations" %}</td>
|
|
||||||
<td>{{ stock_loc_count }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><span class='fas fa-boxes'></span></td>
|
|
||||||
<td>{% trans "Stock Items" %}</td>
|
|
||||||
<td>{{ stock_item_count }}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
Loading…
Reference in New Issue
Block a user