mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-03 20:20:58 +00:00
Convert to "native value" in the serializer
This commit is contained in:
@ -909,6 +909,14 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
help_text=_('Settings key (must be unique - case insensitive'),
|
||||
)
|
||||
|
||||
def to_native_value(self):
|
||||
"""
|
||||
Return the "pythonic" value,
|
||||
e.g. convert "True" to True, and "1" to 1
|
||||
"""
|
||||
|
||||
return self.__class__.get_setting(self.key)
|
||||
|
||||
|
||||
class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||
"""
|
||||
@ -1119,6 +1127,14 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||
'user__id': kwargs['user'].id
|
||||
}
|
||||
|
||||
def to_native_value(self):
|
||||
"""
|
||||
Return the "pythonic" value,
|
||||
e.g. convert "True" to True, and "1" to 1
|
||||
"""
|
||||
|
||||
return self.__class__.get_setting(self.key, user=self.user)
|
||||
|
||||
|
||||
class PriceBreak(models.Model):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user