From 2e1ad0c2458394a57a1da7b4302321162d25768c Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 23 Jun 2021 18:54:01 +1000 Subject: [PATCH 1/3] Change some warnings to infos --- InvenTree/InvenTree/status.py | 6 +++--- InvenTree/InvenTree/test_api.py | 2 +- InvenTree/part/test_param.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/InvenTree/InvenTree/status.py b/InvenTree/InvenTree/status.py index 93b904d55b..512c68e93b 100644 --- a/InvenTree/InvenTree/status.py +++ b/InvenTree/InvenTree/status.py @@ -61,21 +61,21 @@ def is_email_configured(): # Display warning unless in test mode if not settings.TESTING: - logger.warning("EMAIL_HOST is not configured") + logger.debug("EMAIL_HOST is not configured") if not settings.EMAIL_HOST_USER: configured = False # Display warning unless in test mode if not settings.TESTING: - logger.warning("EMAIL_HOST_USER is not configured") + logger.debug("EMAIL_HOST_USER is not configured") if not settings.EMAIL_HOST_PASSWORD: configured = False # Display warning unless in test mode if not settings.TESTING: - logger.warning("EMAIL_HOST_PASSWORD is not configured") + logger.debug("EMAIL_HOST_PASSWORD is not configured") return configured diff --git a/InvenTree/InvenTree/test_api.py b/InvenTree/InvenTree/test_api.py index 8435d756fb..f196006df9 100644 --- a/InvenTree/InvenTree/test_api.py +++ b/InvenTree/InvenTree/test_api.py @@ -77,7 +77,7 @@ class APITests(InvenTreeAPITestCase): self.assertIn('version', data) self.assertIn('instance', data) - self.assertEquals('InvenTree', data['server']) + self.assertEqual('InvenTree', data['server']) def test_role_view(self): """ diff --git a/InvenTree/part/test_param.py b/InvenTree/part/test_param.py index 4e6556e63d..85eea7ee57 100644 --- a/InvenTree/part/test_param.py +++ b/InvenTree/part/test_param.py @@ -23,7 +23,7 @@ class TestParams(TestCase): def test_str(self): t1 = PartParameterTemplate.objects.get(pk=1) - self.assertEquals(str(t1), 'Length (mm)') + self.assertEqual(str(t1), 'Length (mm)') p1 = PartParameter.objects.get(pk=1) self.assertEqual(str(p1), 'M2x4 LPHS : Length = 4mm') From 70a073be21c08c1cf4a9b461866cc05d81cdb828 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 23 Jun 2021 19:28:23 +1000 Subject: [PATCH 2/3] Live update part image --- InvenTree/part/templates/part/part_base.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index 6bb1320e5a..b486e2c589 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -244,7 +244,14 @@ label: 'image', method: 'PATCH', success: function(data, status, xhr) { - location.reload(); + + // If image / thumbnail data present, live update + if (data.image) { + $('#part-image').attr('src', data.image); + } else { + // Otherwise, reload the page + location.reload(); + } } } ); From f0db9bc3d572de31fa14cf82aa7566cd17a266c2 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 23 Jun 2021 19:29:41 +1000 Subject: [PATCH 3/3] Live update of Company image --- InvenTree/company/templates/company/company_base.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/InvenTree/company/templates/company/company_base.html b/InvenTree/company/templates/company/company_base.html index 70af753d66..a276f5df4f 100644 --- a/InvenTree/company/templates/company/company_base.html +++ b/InvenTree/company/templates/company/company_base.html @@ -144,7 +144,12 @@ label: 'image', method: 'PATCH', success: function(data, status, xhr) { - location.reload(); + + if (data.image) { + $('#company-image').attr('src', data.image); + } else { + location.reload(); + } } } );