mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
PEP fixes
This commit is contained in:
parent
d72efc3757
commit
e3c3ed28da
@ -461,7 +461,7 @@ class BaseInvenTreeSetting(models.Model):
|
||||
|
||||
if self.is_bool():
|
||||
value = self.as_bool()
|
||||
|
||||
|
||||
if self.is_int():
|
||||
value = self.as_int()
|
||||
|
||||
@ -643,6 +643,7 @@ class BaseInvenTreeSetting(models.Model):
|
||||
def protected(self):
|
||||
return self.__class__.is_protected(self.key)
|
||||
|
||||
|
||||
def settings_group_options():
|
||||
"""
|
||||
Build up group tuple for settings based on your choices
|
||||
@ -1066,7 +1067,7 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
|
||||
'SIGNUP_GROUP': {
|
||||
'name': _('Group on signup'),
|
||||
'description': _('Group to which new users are assigned on registration'),
|
||||
@ -1121,7 +1122,7 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'validator': bool,
|
||||
'requires_restart': True,
|
||||
},
|
||||
|
||||
|
||||
'ENABLE_PLUGINS_EVENTS': {
|
||||
'name': _('Enable event integration'),
|
||||
'description': _('Enable plugins to respond to internal events'),
|
||||
@ -1203,7 +1204,7 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
|
||||
'HOMEPAGE_STOCK_RECENT': {
|
||||
'name': _('Show recent stock changes'),
|
||||
'description': _('Show recently changed stock items on the homepage'),
|
||||
@ -1385,7 +1386,7 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
|
||||
'PART_SHOW_QUANTITY_IN_FORMS': {
|
||||
'name': _('Show Quantity in Forms'),
|
||||
'description': _('Display available part quantity in some forms'),
|
||||
@ -1399,7 +1400,7 @@ class InvenTreeUserSetting(BaseInvenTreeSetting):
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
|
||||
|
||||
'STICKY_HEADER': {
|
||||
'name': _('Fixed Navbar'),
|
||||
'description': _('The navbar position is fixed to the top of the screen'),
|
||||
|
@ -222,8 +222,8 @@ class UserSettingsApiTest(InvenTreeAPITestCase):
|
||||
Test list URL for user settings
|
||||
"""
|
||||
url = reverse('api-user-setting-list')
|
||||
# test setting with choice
|
||||
response = self.get(url, expected_code=200)
|
||||
|
||||
self.get(url, expected_code=200)
|
||||
|
||||
def test_user_setting_boolean(self):
|
||||
"""
|
||||
@ -293,7 +293,7 @@ class UserSettingsApiTest(InvenTreeAPITestCase):
|
||||
self.assertFalse(str2bool(response.data['value']))
|
||||
|
||||
def test_user_setting_choice(self):
|
||||
|
||||
|
||||
setting = InvenTreeUserSetting.get_setting_object(
|
||||
'DATE_DISPLAY_FORMAT',
|
||||
user=self.user
|
||||
@ -303,10 +303,10 @@ class UserSettingsApiTest(InvenTreeAPITestCase):
|
||||
|
||||
# Check default value
|
||||
self.assertEqual(setting.value, 'YYYY-MM-DD')
|
||||
|
||||
|
||||
# Check that a valid option can be assigned via the API
|
||||
for opt in ['YYYY-MM-DD', 'DD-MM-YYYY', 'MM/DD/YYYY']:
|
||||
|
||||
|
||||
self.patch(
|
||||
url,
|
||||
{
|
||||
@ -332,7 +332,7 @@ class UserSettingsApiTest(InvenTreeAPITestCase):
|
||||
self.assertIn('Chosen value is not a valid option', str(response.data))
|
||||
|
||||
def test_user_setting_integer(self):
|
||||
|
||||
|
||||
setting = InvenTreeUserSetting.get_setting_object(
|
||||
'SEARCH_PREVIEW_RESULTS',
|
||||
user=self.user
|
||||
|
Loading…
Reference in New Issue
Block a user