wagtail

Is there a way to override the label and help text on a FieldPanel?

这一生的挚爱 提交于 2019-12-11 07:47:31
问题 I'd like to change the help text and the label for some of the Page fields in the admin interface. It seems like normally the FieldPanel picks up the label and help text from the model field, but since I'm wanting to change these values for fields on the Page model ( title and search_description , specifically), I can't set verbose_name and help_text on the field itself I tried passing in the heading and help_text keyword arguments to FieldPanel , but I'm still seeing the default label and

Moving Wagtail pages in a migration

只谈情不闲聊 提交于 2019-12-11 07:07:13
问题 I'm restructuring my Wagtail app to remove an IndexPage that only has a single item in it, and moving that item to be a child of the current IndexPage's parent. basically moving from this: Page--| |--IndexPage--| |--ChildPages (there's only ever 1 of these) to this: Page--| |--ChildPage I've made the changes to the models so that this structure is used for creating new content and fixed the relevant views to point to the ChildPage directly. But now I want to migrate the current data to the

Can a wagtail ImageField be restricted to by image dimension

此生再无相见时 提交于 2019-12-11 06:23:51
问题 Can I set make a Wagtail ImageField only accept images of of certain dimensions ? 回答1: Don't know if it's possible, but you can do something like this to restrict uploading images of large sizes: from wagtail.wagtailadmin.forms import WagtailAdminPageForm class BlogPageForm(WagtailAdminPageForm): def clean(self): cleaned_data = super().clean() if (cleaned_data.get('image') and somehow_check_if_img_to_large(): self.add_error('image', 'Error! image is to large!') return cleaned_data class

Implement Wagtail ListBlock module with min/max children

痴心易碎 提交于 2019-12-11 06:06:45
问题 I'm building a new block type for use in the StreamField. It's called an FAQModule and it should allow a title and 1 or more question/answer pairs. class FAQBlock(blocks.StructBlock): headline = blocks.TextBlock(help_text="Enter headline / question") text = blocks.TextBlock(help_text="Enter a description / answer ") class FAQCardsWithListBlock(blocks.StructBlock): title = blocks.TextBlock(help_text="Enter FAQ title") questions = blocks.ListBlock(FAQBlock()) class Meta: label = 'FAQ Block'

How Embed Gist in Wagtail?

时光怂恿深爱的人放手 提交于 2019-12-11 05:26:29
问题 How to insert dynamic gist code in the middle of posts generated by Wagtail (Django Cms)? I searched the documentation of wagtail but did not find anything that could help me automatically insert the github codes. 回答1: Gist is one of the built in content types supported by Wagtail's embedded content feature. Within a rich text field, editors can use the 'media' toolbar icon to enter the URL to the Gist page, and it will appear embedded in the rich text content. Within a StreamField, the

Data migration of image model

别说谁变了你拦得住时间么 提交于 2019-12-11 04:56:43
问题 Hi this is mostly a copy paste of a question asked in Google groups: Thanks to Wagtail docs, I was able to understand how to build a custom image model, BUT, as I have a website with more than 500 contents, I don't want to mess the whole thing up with a bad data migration. In fact, I am not sure of which migration operation I should use here. I think that I should this one: https://docs.djangoproject.com/en/1.8/ref/migration-operations/#altermodeltable Can someone confirm this ? Thanks a lot

Adding superscript to Draftail in Wagtail 2.0

橙三吉。 提交于 2019-12-11 04:05:04
问题 I'm trying to add superscript to the new editor in Wagtail. I see the documentation here: http://docs.wagtail.io/en/v2.0/advanced_topics/customisation/extending_draftail.html Where am I supposed to add the example code? And am I correct in assuming that I will be able to just change the example from feature_name = 'strikethrough' and type_ = 'STRIKETHROUGH' to superscript and it will work? Once this is registered, do I have to modify each RichTextField that I have to include it in the

How to use InlinePanel in ModelAdmin?

戏子无情 提交于 2019-12-11 03:39:44
问题 I'm setting up a model that needs to be created with a number of instances of a sub-model. I want to be able to edit and create this model in the admin interface so I'm adding it using ModelAdmin. According to the documentation I should be able to specify the fields/panels in accordance to normal Page types; however, when I add a InlinePanel I get an KeyError on the related field name. models.py class Application(models.Model): # other fields.... panels = [MultiFieldPanel([ FieldPanel(

Can't edit Streamfield page after 2.5 upgrade

南笙酒味 提交于 2019-12-11 01:44:16
问题 I have a site in local dev using Streamfield and 2 custom StructBlock fields. Works fine in 2.4 but after upgrading to 2.5 I can create the page fine in the admin but when I go to edit that page in the admin after saving it get an error. I tried with a fresh database as well but got the same error. Front end of the page works fine. Start a new project with wagtail start myproject Create a streamfield page with a custom StructBlock field. (Perhaps even just a built in field, haven't tested

Wagtail / Hallo.js - Adding plugins but modified content is not saved

纵饮孤独 提交于 2019-12-10 20:09:12
问题 I'm running on Wagtail 1.3.1, Django 1.7.11. I have activated hallohtml and hallojustify plugins and they appear in toolbar (without icons but buttons are here). The buttons can be used and the modifications are seen in the textarea (I mean that I can center a field for example and I see it). When I publish the page, the modifications made by either hallojustify or hallohtml are not saved whereas I can still use the bold/italic buttons and save the content. It looks like the html is cleaned