2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Fix admin site - Custom admin URL (#5766)

* Update config template file

* Add entry to docs

* Add INVENTREE_ADMIN_ENABLED to settings.py

* Add helper functions for improving admin links

* Refactor existing admin links

* remove debug statements

* Fix custom admin URL

* Expand documentation

* Fix URL

* Improve wording in config_template.yaml

* Extend admin_url tag

- Allow lookup without pk
- Handle case where pk not found
This commit is contained in:
Oliver
2023-10-21 22:12:14 +11:00
committed by GitHub
parent 388b722de1
commit b335728e29
21 changed files with 130 additions and 53 deletions

View File

@ -35,7 +35,7 @@
<h4>{% trans "Plugins" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% url 'admin:plugin_pluginconfig_changelist' as url %}
{% admin_url user "plugin.pluginconfig" None as url %}
{% include "admin_button.html" with url=url %}
{% if plug %}
<button class="btn btn-success" id="install-plugin" title="{% trans 'Install Plugin' %}"><span class='fas fa-plus-circle'></span> {% trans "Install Plugin" %}</button>

View File

@ -3,7 +3,7 @@
{% inventree_customize 'hide_admin_link' as hidden %}
{% if not hidden and user.is_staff %}
{% if url and not hidden and user.is_staff %}
<a href='{{ url }}'>
<button id='admin-button' href='{{ url }}' title='{% trans "View in administration panel" %}' type='button' class='btn btn-primary admin-button'>
<span class='fas fa-user-shield'></span>

View File

@ -139,7 +139,10 @@
<ul class='dropdown-menu dropdown-menu-end inventree-navbar-menu'>
{% if user.is_authenticated %}
{% 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>
{% admin_index user as admin_idx %}
{% if admin_idx %}
<li><a class='dropdown-item' href="{{ admin_idx }}"><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 'account_logout' %}"><span class="fas fa-sign-out-alt"></span> {% trans "Logout" %}</a></li>

View File

@ -1,10 +1,11 @@
{% extends "registration/logged_out.html" %}
{% load i18n %}
{% load inventree_extras %}
{% block content %}
<p>{% translate "You were logged out successfully." %}</p>
<p><a href="{% url 'admin:index' %}">{% translate 'Log in again' %}</a></p>
<p><a href="{% url 'index' %}">{% translate 'Log in again' %}</a></p>
{% endblock content %}