mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Adds support for "multiple choice" field
This commit is contained in:
parent
721d10a9ec
commit
8d7b73e2a8
@ -32,7 +32,15 @@ class SettingsSerializer(InvenTreeModelSerializer):
|
|||||||
Returns the choices available for a given item
|
Returns the choices available for a given item
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return obj.choices()
|
results = []
|
||||||
|
|
||||||
|
for choice in obj.choices():
|
||||||
|
results.append({
|
||||||
|
'value': choice[0],
|
||||||
|
'display_name': choice[1],
|
||||||
|
})
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
class GlobalSettingsSerializer(SettingsSerializer):
|
class GlobalSettingsSerializer(SettingsSerializer):
|
||||||
|
@ -39,7 +39,11 @@ function editSetting(pk, options={}) {
|
|||||||
// First, read the settings object from the server
|
// First, read the settings object from the server
|
||||||
inventreeGet(url, {}, {
|
inventreeGet(url, {}, {
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
|
|
||||||
|
if (response.choices && response.choices.length > 0) {
|
||||||
|
response.type = 'choice';
|
||||||
|
}
|
||||||
|
|
||||||
// Construct the field
|
// Construct the field
|
||||||
var fields = {
|
var fields = {
|
||||||
value: {
|
value: {
|
||||||
|
Loading…
Reference in New Issue
Block a user