mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 04:25:42 +00:00
removes all lines consisting only of spaces
this really bothers me for some reason - nothing technical
This commit is contained in:
@ -9,7 +9,7 @@ from .models import InvenTreeSetting
|
||||
|
||||
|
||||
class SettingsAdmin(ImportExportModelAdmin):
|
||||
|
||||
|
||||
list_display = ('key', 'value')
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ class InvenTreeSetting(models.Model):
|
||||
The key of each item is the name of the value as it appears in the database.
|
||||
|
||||
Each global setting has the following parameters:
|
||||
|
||||
|
||||
- name: Translatable string name of the setting (required)
|
||||
- description: Translatable string description of the setting (required)
|
||||
- default: Default value (optional)
|
||||
@ -412,7 +412,7 @@ class InvenTreeSetting(models.Model):
|
||||
# Evaluate the function (we expect it will return a list of tuples...)
|
||||
return choices()
|
||||
"""
|
||||
|
||||
|
||||
return choices
|
||||
|
||||
@classmethod
|
||||
@ -522,7 +522,7 @@ class InvenTreeSetting(models.Model):
|
||||
# Enforce standard boolean representation
|
||||
if setting.is_bool():
|
||||
value = InvenTree.helpers.str2bool(value)
|
||||
|
||||
|
||||
setting.value = str(value)
|
||||
setting.save()
|
||||
|
||||
@ -664,7 +664,7 @@ class InvenTreeSetting(models.Model):
|
||||
|
||||
if validator == int:
|
||||
return True
|
||||
|
||||
|
||||
if type(validator) in [list, tuple]:
|
||||
for v in validator:
|
||||
if v == int:
|
||||
@ -675,7 +675,7 @@ class InvenTreeSetting(models.Model):
|
||||
def as_int(self):
|
||||
"""
|
||||
Return the value of this setting converted to a boolean value.
|
||||
|
||||
|
||||
If an error occurs, return the default value
|
||||
"""
|
||||
|
||||
@ -685,7 +685,7 @@ class InvenTreeSetting(models.Model):
|
||||
value = self.default_value()
|
||||
|
||||
return value
|
||||
|
||||
|
||||
|
||||
class PriceBreak(models.Model):
|
||||
"""
|
||||
|
@ -19,7 +19,7 @@ def currency_code_default():
|
||||
|
||||
if code not in CURRENCIES:
|
||||
code = 'USD'
|
||||
|
||||
|
||||
return code
|
||||
|
||||
|
||||
|
@ -117,7 +117,7 @@ class SettingsViewTest(TestCase):
|
||||
"""
|
||||
Test for binary value
|
||||
"""
|
||||
|
||||
|
||||
setting = InvenTreeSetting.get_setting_object('PART_COMPONENT')
|
||||
|
||||
self.assertTrue(setting.as_bool())
|
||||
|
@ -19,7 +19,7 @@ class SettingsTest(TestCase):
|
||||
def setUp(self):
|
||||
|
||||
user = get_user_model()
|
||||
|
||||
|
||||
self.user = user.objects.create_user('username', 'user@email.com', 'password')
|
||||
self.user.is_staff = True
|
||||
self.user.save()
|
||||
|
@ -48,7 +48,7 @@ class SettingEdit(AjaxUpdateView):
|
||||
"""
|
||||
|
||||
form = super().get_form()
|
||||
|
||||
|
||||
setting = self.get_object()
|
||||
|
||||
choices = setting.choices()
|
||||
|
Reference in New Issue
Block a user