Adds support for "multiple choice" field

This commit is contained in:
Oliver 2021-11-09 22:25:42 +11:00
parent 721d10a9ec
commit 8d7b73e2a8
2 changed files with 14 additions and 2 deletions

View File

@ -32,7 +32,15 @@ class SettingsSerializer(InvenTreeModelSerializer):
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):

View File

@ -40,6 +40,10 @@ function editSetting(pk, options={}) {
inventreeGet(url, {}, {
success: function(response) {
if (response.choices && response.choices.length > 0) {
response.type = 'choice';
}
// Construct the field
var fields = {
value: {