wagtail

Guidelines for using Wagtail Pages or Django models?

眉间皱痕 提交于 2020-07-10 08:45:10
问题 For example, I want to build an ecommerce website using wagtail, one component is order. I think order should not wagtail Page, but simple Django model, see code below. from django.db import models from wagtail.admin.edit_handlers import ( FieldPanel, StreamFieldPanel, MultiFieldPanel, InlinePanel, ) from wagtail.core.fields import RichTextField from wagtail.core.models import Page # Since product details are shown to users, so need to have a Page for it. class XyzProductPage(Page): template

Using Django handler404 breaks Wagtail redirects

北城以北 提交于 2020-06-28 05:57:10
问题 I have a custom 404 handler that I use for my Django app running the CMS Wagtail. Everything works great with replacing the Django handler404 with a view function of my choosing. Except that it seems to break Wagtails 301 redirect feature. All of the redirects I have now just go to a 404 page. Below is how I am using handler404 in the base app, handler404 = siteapp_views.handler404 回答1: Your 404 handler must return a response with status_code=404 , otherwise the Wagtail redirect middleware

How to prefetch Wagtail post tags?

会有一股神秘感。 提交于 2020-06-18 01:28:30
问题 I have around 10 posts and it is generating about 100 queries to fetch post tags. The taggit library Wagtail used underneath supportprefetch_related, but adding prefetch_related has no effect. After more research, I found that the culprit is Wagtail's ClusterTaggableManager that overrides taggit 's TaggableManager . In the changelog, it says 2.0 (22.04.2016) ~~~~~~~~~~~~~~~~ * Fix: prefetch_related on a ClusterTaggableManager no longer fails (but doesn't prefetch either) It has been 2 years

How to prefetch Wagtail post tags?

喜夏-厌秋 提交于 2020-06-18 01:26:00
问题 I have around 10 posts and it is generating about 100 queries to fetch post tags. The taggit library Wagtail used underneath supportprefetch_related, but adding prefetch_related has no effect. After more research, I found that the culprit is Wagtail's ClusterTaggableManager that overrides taggit 's TaggableManager . In the changelog, it says 2.0 (22.04.2016) ~~~~~~~~~~~~~~~~ * Fix: prefetch_related on a ClusterTaggableManager no longer fails (but doesn't prefetch either) It has been 2 years

Link to specific page in Wagtail CMS

泄露秘密 提交于 2020-06-12 04:49:35
问题 In Wagtail CMS I don't know how to construct a link to a specific page. I want a (fixed, not authored) link in the templates from my BlogIndexPage to my BlogIndexArchivePage and vice versa. In the official docs pageurl looks promising: {% load wagtailcore_tags %} ... <a href="{% pageurl self.blog_page %}"> but I don't understand the notation blog_page , but the page-classes are named like BlogPage or BlogIndexPage . Did I have to define the page I would link to in my models.py - and if so:

Link to specific page in Wagtail CMS

两盒软妹~` 提交于 2020-06-12 04:49:26
问题 In Wagtail CMS I don't know how to construct a link to a specific page. I want a (fixed, not authored) link in the templates from my BlogIndexPage to my BlogIndexArchivePage and vice versa. In the official docs pageurl looks promising: {% load wagtailcore_tags %} ... <a href="{% pageurl self.blog_page %}"> but I don't understand the notation blog_page , but the page-classes are named like BlogPage or BlogIndexPage . Did I have to define the page I would link to in my models.py - and if so:

Pagination in Wagtail

主宰稳场 提交于 2020-05-25 06:09:10
问题 I'm fairly new to Wagtail, and I am in the process of creating a site that will have a Resources (blog) section and I'm not sure how to implement pagination so that there are only 5 posts on each page and the user has to click a number (1, 2, 3, etc.) to go to the next page to see the next 5 posts. I have this in my template for the pagination section of the resource/blog index page: <ul class="pagination"> <li><a href="#"><i class="fa fa-angle-left"></i></a></li> <li class="active"><a href="

Pagination in Wagtail

♀尐吖头ヾ 提交于 2020-05-25 06:08:22
问题 I'm fairly new to Wagtail, and I am in the process of creating a site that will have a Resources (blog) section and I'm not sure how to implement pagination so that there are only 5 posts on each page and the user has to click a number (1, 2, 3, etc.) to go to the next page to see the next 5 posts. I have this in my template for the pagination section of the resource/blog index page: <ul class="pagination"> <li><a href="#"><i class="fa fa-angle-left"></i></a></li> <li class="active"><a href="

How to give user option to select a wagtail collection of images in page?

假如想象 提交于 2020-05-13 13:34:41
问题 I am looking for a way to show a list of wagtail collection as a field in a page (just like it showing when you upload an image). A user can select a collection and I can programmatically filter the images to the selected collection. I am still new to wagtail and I am not sure how should I implement this in code. Thank you in advance for your help. 回答1: So there's a couple ways you can do this. The first, and probably the least-ideal way is to register Collection as a snippet and use a

How to give user option to select a wagtail collection of images in page?

一个人想着一个人 提交于 2020-05-13 13:34:08
问题 I am looking for a way to show a list of wagtail collection as a field in a page (just like it showing when you upload an image). A user can select a collection and I can programmatically filter the images to the selected collection. I am still new to wagtail and I am not sure how should I implement this in code. Thank you in advance for your help. 回答1: So there's a couple ways you can do this. The first, and probably the least-ideal way is to register Collection as a snippet and use a