Introspect proxy's parent only it is a model
Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -378,6 +378,7 @@ class Menu(object):
|
|||||||
if type(resolved_navigation_object) == bound_source:
|
if type(resolved_navigation_object) == bound_source:
|
||||||
# Check to see if object is a proxy model. If it is, add its parent model
|
# Check to see if object is a proxy model. If it is, add its parent model
|
||||||
# menu links too.
|
# menu links too.
|
||||||
|
if hasattr(resolved_navigation_object, '_meta'):
|
||||||
parent_model = resolved_navigation_object._meta.proxy_for_model
|
parent_model = resolved_navigation_object._meta.proxy_for_model
|
||||||
if parent_model:
|
if parent_model:
|
||||||
parent_instance = parent_model.objects.filter(pk=resolved_navigation_object.pk)
|
parent_instance = parent_model.objects.filter(pk=resolved_navigation_object.pk)
|
||||||
|
|||||||
Reference in New Issue
Block a user