mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
move goup forming into own function
This commit is contained in:
parent
27aec4246e
commit
e0887cf55f
@ -182,12 +182,9 @@ class BaseInvenTreeSetting(models.Model):
|
|||||||
else:
|
else:
|
||||||
choices = None
|
choices = None
|
||||||
|
|
||||||
"""
|
if callable(choices):
|
||||||
TODO:
|
|
||||||
if type(choices) is function:
|
|
||||||
# Evaluate the function (we expect it will return a list of tuples...)
|
# Evaluate the function (we expect it will return a list of tuples...)
|
||||||
return choices()
|
return choices()
|
||||||
"""
|
|
||||||
|
|
||||||
return choices
|
return choices
|
||||||
|
|
||||||
@ -478,6 +475,8 @@ class BaseInvenTreeSetting(models.Model):
|
|||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
def group_options():
|
||||||
|
return [('', _('No group')), *[(str(a.id), str(a)) for a in Group.objects.all()]]
|
||||||
|
|
||||||
class InvenTreeSetting(BaseInvenTreeSetting):
|
class InvenTreeSetting(BaseInvenTreeSetting):
|
||||||
"""
|
"""
|
||||||
@ -849,10 +848,7 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
|||||||
'name': _('Group on signup'),
|
'name': _('Group on signup'),
|
||||||
'description': _('Group new user are asigned on registration'),
|
'description': _('Group new user are asigned on registration'),
|
||||||
'default': '',
|
'default': '',
|
||||||
'choices': [
|
'choices': group_options
|
||||||
('', _('No group')),
|
|
||||||
*[(str(a.id), str(a)) for a in Group.objects.all()]
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user