wagtailmenus | render menus in your Wagtail projects | Content Management System library
kandi X-RAY | wagtailmenus Summary
kandi X-RAY | wagtailmenus Summary
An app to help you manage and render menus in your Wagtail projects more effectively
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Prime a menu item .
- Derive a single page from the site .
- Render a sub - menu template .
- Get a specific sub menu template name .
- Returns a list of wagtailmenus items .
- Modify menu items .
- Render a flat menu .
- Create a repeated menu item .
- Render a section menu .
- Render the children menu .
wagtailmenus Key Features
wagtailmenus Examples and Code Snippets
{% for item in menu_items %}
... {{ item.link_page.title}} ...
class TranslatableFlatMenuAdmin(FlatMenuAdmin):
def get_list_display(self, request):
if self.is_multisite_listing(request):
return ('title', 'language', 'handle_formatted', 'site', 'items')
return ('title',
def makeExtension(configs={}):
return MathJaxExtension(**configs)
import markdown
import cgi
class MathJaxPattern(markdown.inlinepatterns.Pattern):
def __init__(self, md):
markdown.inlinepatterns.P
{% load static wagtailcore_tags %}
{% for item in page.get_children.live.in_menu %}
-
{{ item.title }}
{% for subitem in item.get_children.live.in_menu %}
[...]
def runtests():
[...]
try:
execute_from_command_line(argv)
except:
pass
if __name__ == '__main__':
runtests()
import sys
[...]
def runtests():
[...]
return execute_f
Community Discussions
Trending Discussions on wagtailmenus
QUESTION
I'm using Wagtailmenus 3.0.2.
The documentation says:
If the template is for rendering the first level of a main or flat menu, then menu_items will be a list of MainMenuItem or FlatMenuItem objects (respectively). In all other cases. it will be a list Page objects.
(https://wagtailmenus.readthedocs.io/en/v3.0/rendering_menus/custom_templates.html)
I'm using a FlatMenu with only one level. I need to access Page fields but it's not rendered in the template.
When I use a multilevel menu, I can access Page fields inside the submenu without problem.
I wonder if there is a way to access Page fields inside the first level menu.
Thanks in advance for your help!
...ANSWER
Answered 2022-Feb-03 at 21:55You can use item.link_page at top level of menu, for example:
QUESTION
I am trying to pass some wagtail contexts to the search page of a django project. The post title appears but the image, description and other parameters do not appear in the search template. How do I pass these contexts to the search template?
This is the error I get
...ANSWER
Answered 2021-Feb-08 at 10:26It seems like the news_page
variable in your template is a string, rather than a page object, as that's the only use of the {% routablepageurl %}
tag in the code examples you have shared. However, you don't show where news_page
is defined, so I may be mistaken.
I have now looked at your models file, and where you define news_page
. You have defined news_page
in the context of NewsIndexPage. This will be used when displaying a NewsIndexPage, using Wagtail's internal views, but this is not used when rendering the search view.
Here's the response context you are setting in your search/views.py
:
QUESTION
I have been using the AbstractLinkPage
model from wagtailmenus in my site for a while now. I find it quite useful.
Source: wagtailmenus AbstractLinkPage model
My site is building cards from children pages and adds banner images from children pages automatically to these cards. Some of the children pages are LinkPages
.
How can I extend the subclassed LinkPage
(from AbstractLinkPage
) to add a generic image which can be used as a card image?
I have added the field:
...ANSWER
Answered 2020-Oct-08 at 19:42Wagtailmenus uses it's own tabbed interface (in wagtailmenus.panels):
QUESTION
I'm using the wagtailmenus library with some custom models as described here. Nothing major, it just adds a language field:
...ANSWER
Answered 2020-Jul-09 at 08:15I'm not to well-versed on wagtailmenus, but it thinks WAGTAILMENUS_FLAT_MENUS_MODELADMIN_CLASS is the setting you're looking for.
To change the fields in list_display
, you would have to subclass wagtailmenus; FlatMenuAdmin
and override its get_list_display
function:
QUESTION
I'm following this tutorial to add LaTeX support to markdown, and I get this error:
Environment:
Request Method: GET Request URL: http://localhost/posts/ttttt/
Django Version: 2.2.10 Python Version: 3.7.3 Installed Applications: ['home', 'search', 'info', 'list', 'streams', 'post', 'faq', 'registration', 'snippet', 'wagtailmd', 'wagtailcodeblock', 'wagtail.contrib.forms', 'wagtail.contrib.redirects', 'wagtail.embeds', 'wagtail.sites', 'wagtail.users', 'wagtail.snippets', 'wagtail.documents', 'wagtail.images', 'wagtail.search', 'wagtail.admin', 'wagtail.core', 'wagtail.contrib.modeladmin', 'wagtail.contrib.styleguide', 'modelcluster', 'taggit', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'django.contrib.humanize', 'allauth', 'allauth.account', 'allauth.socialaccount', 'crispy_forms', 'wagtailmenus', 'captcha', 'wagtailcaptcha'] Installed Middleware: ['django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'wagtail.core.middleware.SiteMiddleware', 'wagtail.contrib.redirects.middleware.RedirectMiddleware']
Template error: In template C:\Users\abdom\OneDrive\Desktop\project\website\templates\base.html, error at line 0 init() takes 1 positional argument but 2 were given 1 : {% load static wagtailuserbar %} 2 : {% load menu_tags %} 3 : 4 : 5 : 6 :
7 : 8 : 9 : {% block title %} 10 : {% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %}Traceback:
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\core\handlers\exception.py" in inner 34. response = get_response(request)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\wagtail\core\models.py" in _get_response 1254. response = response.render()
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\response.py" in render 106. self.content = self.rendered_content
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\response.py" in rendered_content 83. content = template.render(context, self._request)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\backends\django.py" in render 61. return self.template.render(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\base.py" in render 171. return self._render(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\base.py" in _render 163. return self.nodelist.render(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\base.py" in render 937. bit = node.render_annotated(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\base.py" in render_annotated 904. return self.render(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\loader_tags.py" in render 150. return compiled_parent._render(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\base.py" in _render 163. return self.nodelist.render(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\base.py" in render 937. bit = node.render_annotated(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\base.py" in render_annotated 904. return self.render(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\loader_tags.py" in render 62. result = block.nodelist.render(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\base.py" in render 937. bit = node.render_annotated(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\base.py" in render_annotated 904. return self.render(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\base.py" in render 987. output = self.filter_expression.resolve(context)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\django\template\base.py" in resolve 698. new_obj = func(obj, *arg_vals)
File "C:\Users\abdom\OneDrive\Desktop\project\wagtailmd\templatetags\wagtailmd.py" in markdown_filter 14. output_format='html5'
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\markdown\core.py" in markdown 387. md = Markdown(**kwargs)
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\markdown\core.py" in init 97. configs=kwargs.get('extension_configs', {}))
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\markdown\core.py" in registerExtensions 123. ext = self.build_extension(ext, configs.get(ext, {}))
File "C:\Users\abdom\OneDrive\Desktop\project.venv\lib\site-packages\markdown\core.py" in build_extension 178. return module.makeExtension(**configs)
File "C:\Users\abdom\OneDrive\Desktop\project\wagtailmd\mdx\mdx_mathjax.py" in makeExtension 23. return MathJaxExtension(configs)
Exception Type: TypeError at /posts/ttttt/ Exception Value: init() takes 1 positional argument but 2 were given
mdx_mathjax.py :
...ANSWER
Answered 2020-Feb-11 at 18:51You have an implementation error in your code. According to markdown
's documentation, you should define what parameters you want to provide to your custom Extension
.
And if you do not have any configurations yet, you should use something like below:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install wagtailmenus
You can use wagtailmenus like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page