mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Display singleton settings in the settings tab
- Only visible to 'staff' user
This commit is contained in:
parent
098cd0ec44
commit
2c1a744c2d
@ -16,6 +16,7 @@ from django.views.generic import UpdateView, CreateView
|
||||
from django.views.generic.base import TemplateView
|
||||
|
||||
from part.models import Part
|
||||
from common.models import InvenTreeSetting
|
||||
|
||||
from .forms import DeleteForm, EditUserForm, SetPasswordForm
|
||||
from .helpers import str2bool
|
||||
@ -511,3 +512,11 @@ class SettingsView(TemplateView):
|
||||
"""
|
||||
|
||||
template_name = "InvenTree/settings.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
||||
ctx = super().get_context_data(**kwargs).copy()
|
||||
|
||||
ctx['settings'] = InvenTreeSetting.objects.all().order_by('key')
|
||||
|
||||
return ctx
|
||||
|
@ -5,11 +5,17 @@ from django.contrib import admin
|
||||
|
||||
from import_export.admin import ImportExportModelAdmin
|
||||
|
||||
from .models import Currency
|
||||
from .models import Currency, InvenTreeSetting
|
||||
|
||||
|
||||
class CurrencyAdmin(ImportExportModelAdmin):
|
||||
list_display = ('symbol', 'suffix', 'description', 'value', 'base')
|
||||
|
||||
|
||||
class SettingsAdmin(ImportExportModelAdmin):
|
||||
|
||||
list_display = ('key', 'value', 'description')
|
||||
|
||||
|
||||
admin.site.register(Currency, CurrencyAdmin)
|
||||
admin.site.register(InvenTreeSetting, SettingsAdmin)
|
||||
|
@ -8,4 +8,23 @@
|
||||
|
||||
<h4>InvenTree Settings</h4>
|
||||
|
||||
<table class='table table-striped table-condensed' id='other-table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Setting</th>
|
||||
<th>Value</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for setting in settings %}
|
||||
<tr>
|
||||
<td>{{ setting.key }}</td>
|
||||
<td>{{ setting.value }}</td>
|
||||
<td>{{ setting.description }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user