mirror of https://github.com/jumpserver/jumpserver
parent
5f9f970abd
commit
4e3e166132
|
@ -47,5 +47,26 @@ $(document).ready(function () {
|
||||||
closeOnSelect: false
|
closeOnSelect: false
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
.on("submit", "form", function (evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
var the_url = '{% url 'api-users:user-group-list' %}';
|
||||||
|
var redirect_to = '{% url "users:user-group-list" %}';
|
||||||
|
var method = "POST";
|
||||||
|
{% if type == "update" %}
|
||||||
|
the_url = '{% url 'api-users:user-group-detail' pk=object.id %}';
|
||||||
|
method = "PUT";
|
||||||
|
{% endif %}
|
||||||
|
var form = $("form");
|
||||||
|
var data = form.serializeObject();
|
||||||
|
objectAttrsIsList(data, ['users']);
|
||||||
|
var props = {
|
||||||
|
url: the_url,
|
||||||
|
data: data,
|
||||||
|
method: method,
|
||||||
|
form: form,
|
||||||
|
redirect_to: redirect_to
|
||||||
|
};
|
||||||
|
formSubmit(props);
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -44,6 +44,7 @@ class UserGroupCreateView(PermissionsMixin, SuccessMessageMixin, CreateView):
|
||||||
context = {
|
context = {
|
||||||
'app': _('Users'),
|
'app': _('Users'),
|
||||||
'action': _('Create user group'),
|
'action': _('Create user group'),
|
||||||
|
'type': 'create'
|
||||||
}
|
}
|
||||||
kwargs.update(context)
|
kwargs.update(context)
|
||||||
return super().get_context_data(**kwargs)
|
return super().get_context_data(**kwargs)
|
||||||
|
@ -61,6 +62,7 @@ class UserGroupUpdateView(PermissionsMixin, SuccessMessageMixin, UpdateView):
|
||||||
context = {
|
context = {
|
||||||
'app': _('Users'),
|
'app': _('Users'),
|
||||||
'action': _('Update user group'),
|
'action': _('Update user group'),
|
||||||
|
'type': 'update'
|
||||||
|
|
||||||
}
|
}
|
||||||
kwargs.update(context)
|
kwargs.update(context)
|
||||||
|
|
Loading…
Reference in New Issue