diff --git a/apps/common/templates/common/basic_setting.html b/apps/common/templates/common/basic_setting.html index fb5039795..9d67d762d 100644 --- a/apps/common/templates/common/basic_setting.html +++ b/apps/common/templates/common/basic_setting.html @@ -20,6 +20,9 @@
  • {% trans 'LDAP setting' %}
  • +
  • + {% trans 'Storage setting' %} +
  • diff --git a/apps/common/templates/common/email_setting.html b/apps/common/templates/common/email_setting.html index 7561849bd..2cd018021 100644 --- a/apps/common/templates/common/email_setting.html +++ b/apps/common/templates/common/email_setting.html @@ -20,6 +20,9 @@
  • {% trans 'LDAP setting' %}
  • +
  • + {% trans 'Storage setting' %} +
  • diff --git a/apps/common/templates/common/ldap_setting.html b/apps/common/templates/common/ldap_setting.html index 26f021569..de4a196c9 100644 --- a/apps/common/templates/common/ldap_setting.html +++ b/apps/common/templates/common/ldap_setting.html @@ -20,6 +20,9 @@
  • {% trans 'LDAP setting' %}
  • +
  • + {% trans 'Storage setting' %} +
  • diff --git a/apps/common/templates/common/storage_setting.html b/apps/common/templates/common/storage_setting.html new file mode 100644 index 000000000..cf2c243f1 --- /dev/null +++ b/apps/common/templates/common/storage_setting.html @@ -0,0 +1,102 @@ +{% extends 'base.html' %} +{% load static %} +{% load bootstrap3 %} +{% load i18n %} +{% load common_tags %} + +{% block content %} +
    +
    +
    +
    + +
    +
    +
    +
    + {% if form.non_field_errors %} +
    + {{ form.non_field_errors }} +
    + {% endif %} + {% csrf_token %} +

    {% trans "Command storage" %}

    + + + + + + + + + + +
    {% trans 'Name' %}{% trans 'Engine' %}{% trans 'Action' %}
    + +
    +

    {% trans "Replay storage" %}

    + +
    +
    +
    + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +{% endblock %} +{% block custom_foot_js %} + +{% endblock %} diff --git a/apps/common/urls/view_urls.py b/apps/common/urls/view_urls.py index ff8086bde..57594b043 100644 --- a/apps/common/urls/view_urls.py +++ b/apps/common/urls/view_urls.py @@ -10,4 +10,5 @@ urlpatterns = [ url(r'^$', views.BasicSettingView.as_view(), name='basic-setting'), url(r'^email/$', views.EmailSettingView.as_view(), name='email-setting'), url(r'^ldap/$', views.LDAPSettingView.as_view(), name='ldap-setting'), + url(r'^storage/$', views.StorageSettingView.as_view(), name='storage-setting'), ] diff --git a/apps/common/views.py b/apps/common/views.py index 4135ca82c..6ab46ead4 100644 --- a/apps/common/views.py +++ b/apps/common/views.py @@ -4,6 +4,7 @@ from django.contrib import messages from django.utils.translation import ugettext as _ from .forms import EmailSettingForm, LDAPSettingForm, BasicSettingForm +from .models import Setting from .mixins import AdminUserRequiredMixin from .signals import ldap_auth_enable @@ -86,3 +87,30 @@ class LDAPSettingView(AdminUserRequiredMixin, TemplateView): context = self.get_context_data() context.update({"form": form}) return render(request, self.template_name, context) + + +class StorageSettingView(AdminUserRequiredMixin, TemplateView): + form_class = LDAPSettingForm + template_name = "common/storage_setting.html" + + def get_context_data(self, **kwargs): + context = { + 'app': _('Settings'), + 'action': _('Storage setting'), + 'form': self.form_class(), + 'command_storage': Setting.objects.filter(name__endswith="_COMMAND_STORAGE") + } + kwargs.update(context) + return super().get_context_data(**kwargs) + + def post(self, request): + form = self.form_class(request.POST) + if form.is_valid(): + form.save() + msg = _("Update setting successfully, please restart program") + messages.success(request, msg) + return redirect('settings:storage-setting') + else: + context = self.get_context_data() + context.update({"form": form}) + return render(request, self.template_name, context) diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 2c7f39971..55e035bfe 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -1311,7 +1311,7 @@ msgstr "Email主题前缀" #: common/forms.py:76 msgid "Enable LDAP Auth" -msgstr "二次验证" +msgstr "LDAP认证" #: common/forms.py:82 msgid "SMTP host"