Skip to content

Commit

Permalink
Merge pull request #397 from johnmikep/master
Browse files Browse the repository at this point in the history
Update utils.py
  • Loading branch information
grahamgilbert authored Jul 9, 2020
2 parents bbe975c + 16af862 commit 687e40d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 687e40d

Please sign in to comment.