mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 11:36:44 +00:00
* Add tags to test if CUI or PUI are enabled * Fix PUI redirect (cherry picked from commit 6bf6733268566e9c8810dc60049e453b108f0c53) Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
parent
e56d013e2e
commit
847322e474
@ -86,6 +86,7 @@ ENABLE_CLASSIC_FRONTEND = get_boolean_setting(
|
|||||||
# Disable CUI parts if CUI tests are disabled
|
# Disable CUI parts if CUI tests are disabled
|
||||||
if TESTING and '--exclude-tag=cui' in sys.argv:
|
if TESTING and '--exclude-tag=cui' in sys.argv:
|
||||||
ENABLE_CLASSIC_FRONTEND = False
|
ENABLE_CLASSIC_FRONTEND = False
|
||||||
|
|
||||||
ENABLE_PLATFORM_FRONTEND = get_boolean_setting(
|
ENABLE_PLATFORM_FRONTEND = get_boolean_setting(
|
||||||
'INVENTREE_PLATFORM_FRONTEND', 'platform_frontend', True
|
'INVENTREE_PLATFORM_FRONTEND', 'platform_frontend', True
|
||||||
)
|
)
|
||||||
|
@ -670,3 +670,15 @@ def admin_url(user, table, pk):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag()
|
||||||
|
def cui_enabled():
|
||||||
|
"""Return True if the CUI is enabled."""
|
||||||
|
return settings.ENABLE_CLASSIC_FRONTEND
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag()
|
||||||
|
def pui_enabled():
|
||||||
|
"""Return True if the PUI is enabled."""
|
||||||
|
return settings.ENABLE_PLATFORM_FRONTEND
|
||||||
|
@ -504,14 +504,14 @@ urlpatterns.append(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Send any unknown URLs to the parts page
|
# Send any unknown URLs to the index page
|
||||||
urlpatterns += [
|
urlpatterns += [
|
||||||
re_path(
|
re_path(
|
||||||
r'^.*$',
|
r'^.*$',
|
||||||
RedirectView.as_view(
|
RedirectView.as_view(
|
||||||
url='/index/'
|
url='/index/'
|
||||||
if settings.ENABLE_CLASSIC_FRONTEND
|
if settings.ENABLE_CLASSIC_FRONTEND
|
||||||
else settings.FRONTEND_URL_BASE,
|
else f'/{settings.FRONTEND_URL_BASE}/',
|
||||||
permanent=False,
|
permanent=False,
|
||||||
),
|
),
|
||||||
name='index',
|
name='index',
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% inventree_customize 'hide_pui_banner' as hidden %}
|
{% inventree_customize 'hide_pui_banner' as hidden %}
|
||||||
|
{% pui_enabled as pui %}
|
||||||
|
|
||||||
{% if not hidden %}
|
{% if pui and not hidden %}
|
||||||
<div class='alert alert-block alert-warning'>
|
<div class='alert alert-block alert-warning'>
|
||||||
{% if mode == 'admin' %}
|
{% if mode == 'admin' %}
|
||||||
{% trans "Platform UI - the new UI for InvenTree - provides more modern administration options." %}
|
{% trans "Platform UI - the new UI for InvenTree - provides more modern administration options." %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user