From 8a58bf5ffa2555b93e7cc4c363e89a8504a4ed30 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 13 Jul 2023 20:39:28 +1000 Subject: [PATCH] Only update theme if value provided (#5240) (#5241) - Handles case where null or invalid value provided (cherry picked from commit 41167f22c9943a2a0f389fd24f595f137bf2271f) Co-authored-by: Oliver --- InvenTree/InvenTree/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py index 9cb04e09d1..101659eb75 100644 --- a/InvenTree/InvenTree/views.py +++ b/InvenTree/InvenTree/views.py @@ -640,8 +640,12 @@ class AppearanceSelectView(RedirectView): user_theme = common_models.ColorTheme() user_theme.user = request.user - user_theme.name = theme - user_theme.save() + if theme: + try: + user_theme.name = theme + user_theme.save() + except Exception: + pass return redirect(reverse_lazy('settings'))