Skip to content

Commit

Permalink
Load plugins ordered.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsilva committed Dec 17, 2020
1 parent 3bde9f5 commit db4cae8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions xadmin/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,11 @@ def __init__(self, request, *args, **kwargs):
self.request_method = request.method.lower()
self.user = request.user

self.base_plugins = [p(self) for p in getattr(self,
"plugin_classes", [])]
def plugin_order_key(plugin):
return getattr(plugin, 'order', 100)

self.base_plugins = sorted((p(self) for p in getattr(self, "plugin_classes", [])),
key=plugin_order_key)

self.args = args
self.kwargs = kwargs
Expand Down

0 comments on commit db4cae8

Please sign in to comment.