mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add some context data to the view for editing a setting
This commit is contained in:
parent
e3f5e8fbb1
commit
b57a78dea4
14
InvenTree/common/templates/common/edit_setting.html
Normal file
14
InvenTree/common/templates/common/edit_setting.html
Normal file
@ -0,0 +1,14 @@
|
||||
{% extends "modal_form.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block pre_form_content %}
|
||||
|
||||
{{ block.super }}
|
||||
|
||||
<p>
|
||||
<b>{{ name }}</b><br>
|
||||
{{ description }}<br>
|
||||
<i>{% trans "Current value" %}: {{ value }}</i>
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
@ -46,3 +46,20 @@ class SettingEdit(AjaxUpdateView):
|
||||
model = models.InvenTreeSetting
|
||||
ajax_form_title = _('Change Setting')
|
||||
form_class = forms.SettingEditForm
|
||||
ajax_template_name = "common/edit_setting.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
"""
|
||||
Add extra context information about the particular setting object.
|
||||
"""
|
||||
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
|
||||
setting = self.get_object()
|
||||
|
||||
ctx['key'] = setting.key
|
||||
ctx['value'] = setting.value
|
||||
ctx['name'] = models.InvenTreeSetting.get_setting_name(setting.key)
|
||||
ctx['description'] = models.InvenTreeSetting.get_setting_description(setting.key)
|
||||
|
||||
return ctx
|
||||
|
Loading…
Reference in New Issue
Block a user