Closed inostia closed 4 years ago
Hi, I'm trying to implement sub-menus on a site and I'm hitting an error.
Running:
Django==2.2.9 wagtail==2.7.2 wagtailmenus<3.1
Here's my template code which is throwing an error after adding the sub_menu code:
sub_menu
{% for item in menu_items %} <li class="{{item.active_class}}"> <a href="{{item.href}}">{{item.text}}</a> {% if item.sub_menu %} <ul class="portal-sub-nav"> {% for sub_item in item.sub_menu.items %} <li class="{{ sub_item.active_class }}"><a href="{{ sub_item.href }}">{{ sub_item.text }}</a></li> {% endfor %} </ul> {% endif %} </li> {% endfor %}
When I go to render my page, I get a TypeError: get_url() got an unexpected keyword argument 'request'.
TypeError
get_url() got an unexpected keyword argument 'request'
The error comes from this line 519 at /wagtailmenus/models/menus.py in _prime_menu_item:
/wagtailmenus/models/menus.py in _prime_menu_item
item.href = item.relative_url(current_site, request=request)
The wagtail core code for get_url at line 854 of /wagtail/core/models.py is:
get_url
/wagtail/core/models.py
def relative_url(self, current_site, request=None): ... return self.get_url(request=request, current_site=current_site)
Did I miss something or is this a bug?
I'm not sure what the issue was, but it was solved by using {% sub_menu item %}.
{% sub_menu item %}
Hi, I'm trying to implement sub-menus on a site and I'm hitting an error.
Running:
Here's my template code which is throwing an error after adding the
sub_menu
code:When I go to render my page, I get a
TypeError
:get_url() got an unexpected keyword argument 'request'
.The error comes from this line 519 at
/wagtailmenus/models/menus.py in _prime_menu_item
:The wagtail core code for
get_url
at line 854 of/wagtail/core/models.py
is:Did I miss something or is this a bug?