Improve code to unbind menu entries.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
- Equalize dashboard widgets heights.
|
||||
- Switch the order of the DEFAULT_AUTHENTICATION_CLASSES of DRF. GitLab #400.
|
||||
- Backport document's version list view permission.
|
||||
- Improve code to unbind menu entries.
|
||||
|
||||
2.5.2 (2017-07-08)
|
||||
==================
|
||||
|
||||
@@ -65,6 +65,7 @@ Other Changes
|
||||
- Sort setting by namespace label and by global name second.
|
||||
- Sort indexes by label.
|
||||
- Switch the order of the DEFAULT_AUTHENTICATION_CLASSES of DRF. GitLab #400.
|
||||
- Improve code to unbind menu entries.
|
||||
|
||||
Removals
|
||||
--------
|
||||
|
||||
@@ -206,13 +206,15 @@ class Menu(object):
|
||||
unbound_links.extend(self.unbound_links.get(source, ()))
|
||||
unbound_links.extend(self.unbound_links.get(current_view, ()))
|
||||
|
||||
new_result = []
|
||||
for resolved_link in result[0]:
|
||||
try:
|
||||
if resolved_link.link in unbound_links:
|
||||
result[0].remove(resolved_link)
|
||||
if resolved_link.link not in unbound_links:
|
||||
new_result.append(resolved_link)
|
||||
except AttributeError:
|
||||
# It's a menu, ignore
|
||||
pass
|
||||
new_result.append(resolved_link)
|
||||
|
||||
result[0] = new_result
|
||||
|
||||
# Sort links by position value passed during bind
|
||||
result[0] = sorted(
|
||||
|
||||
Reference in New Issue
Block a user