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