From 16af8622e6856bf60c98937ae78884ba98782d44 Mon Sep 17 00:00:00 2001 From: johnmikep <45859899+johnmikep@users.noreply.github.com> Date: Thu, 9 Jul 2020 10:16:22 -0500 Subject: [PATCH] Update utils.py --- server/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/utils.py b/server/utils.py index f79b16b2..4d1e050a 100644 --- a/server/utils.py +++ b/server/utils.py @@ -540,7 +540,8 @@ def get_active_and_inactive_plugins(plugin_kind='machines'): def unique_plugin_order(plugin_type='machines'): model = PLUGIN_MODELS[plugin_type][0] try: - id_max = model.objects.aggregate(Max('order'))['order__max'] + # Return 0 if no machine plugins exist + id_max = model.objects.aggregate(Max('order'))['order__max'] or 0 except KeyError: id_max = 0 return id_max + 1