2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 20:20:58 +00:00

Small tweaks

- Factor out native_value property (not needed!)
- PEP fixes
This commit is contained in:
Oliver Walters
2022-05-01 22:30:24 +10:00
parent f794d91e5c
commit d72efc3757
2 changed files with 4 additions and 16 deletions

View File

@ -398,17 +398,6 @@ class BaseInvenTreeSetting(models.Model):
def units(self):
return self.__class__.get_setting_units(self.key)
@property
def native_value(self):
if self.is_bool():
return self.as_bool()
if self.is_int():
return self.as_int()
return self.value
def clean(self, **kwargs):
"""
If a validator (or multiple validators) are defined for a particular setting key,
@ -418,7 +407,7 @@ class BaseInvenTreeSetting(models.Model):
super().clean()
# Encode as native values
self.value = self.native_value
self.value = self.to_native_value()
validator = self.__class__.get_setting_validator(self.key, **kwargs)
@ -1432,7 +1421,7 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
('MMM DD YYYY', 'Feb 22 2022'),
]
},
'DISPLAY_SCHEDULE_TAB': {
'name': _('Part Scheduling'),
'description': _('Display part scheduling information'),