Questions tagged [wagtail-streamfield]

Wagtail-streamfield is the feature of Wagtail which let you create a sequence of blocks of different types to be rearranged as desired. Build and arrange your content blocks in any order: headings, paragraphs, images, video, and custom content types specific to your site.

Wagtail is a CMS for Django. Wagtail comes up with lots of features and wagtail-streamfield is one of it. It allows a user to build and arranges content blocks in any order: headings, paragraphs, images, video, and custom content types specific to a site. enter image description here

The outstanding characteristic of it is "Better Rich Text", "Classy Implementation","Simple Editing","Content economy".

170 questions
3
votes
1 answer

Is there any way to add a custom unique identifier to a wagtail block

I am looking to create a streamfield of items with each item having a custom id. I have created an 'ItemBlock' and added a 'unique_identifier' attribute which is populated using uuid4. The issue is that each item has the same uuid. Is there a way to…
3
votes
0 answers

Retrieve first image from a Wagtail Streamfield for blog_index_page

Assume I am following the Your first Wagtail site tutorial, except I want to use a Streamfield, instead of separate RichTextField or BlogPageGalleryImage. For example : class BlogPage(Page): date = models.DateField("Post date") intro =…
Inyoka
  • 1,287
  • 16
  • 24
3
votes
1 answer

Injecting snippets into a Wagtail StreamField interface

My company is using Wagtail to build robust pages for our website, likely using the StreamField component. We're wondering if Wagtail allows the possibility of us creating reusable parts (perhaps in a snippet), and injecting them into a page. I'm…
commadelimited
  • 5,656
  • 6
  • 41
  • 77
3
votes
0 answers

wagtail customizing generated admin from for parentalkey

In Wagtail document, I find an explanatory example showing how you can customize the behavior of admin form adding a few validation and save perks: from django import forms import geocoder # not in Wagtail, for example only -…
3
votes
1 answer

How to add computed variable to the wagtail StructBlock template context?

I want to compute some custom variable based on the other block values in the StructBlock and add this custom variable to the template context. Essentially I should be able to use this computed variable in the StructBlock template like so {{…
NarūnasK
  • 4,564
  • 8
  • 50
  • 76
3
votes
2 answers

What is correct way of inserting wagtail streamfield block dependencies into the template?

I rely on template inheritance system to insert extra_css and/or extra_js into my pages: base.html: {% block extra_css %} {# Override this in templates to add…
NarūnasK
  • 4,564
  • 8
  • 50
  • 76
3
votes
2 answers

Creating sub-lists with Wagtail RichText streamfield

I'm building a website using the Wagtail CMS for Django. I'm currently using a RichText streamfield block to add content to a page. Content editors can use the list icon in the WYSIWYG editor to add a list to a page. However, as a content editor,…
S. Sharp
  • 43
  • 3
3
votes
1 answer

Wagtail Show latest blog posts on Homepage through a streamfield

I have 3 mains sections in my site, homepage, blog index, and blog specific. I am using the streamfield function in wagtail to order various sections in the homepage. One of those sections is for the latest three blog posts. I have done this for the…
3
votes
2 answers

Wagtail SnippetChooserBlock in Streamfield

I am having some trouble getting the values from a snippet, that I have included into a streamfield using a Snippet Chooser Block. BioSnippet: @register_snippet class BioSnippet(models.Model): name = models.CharField(max_length=200, null=True) …
2
votes
1 answer

Default blocks for wagtail's StreamField when a new Page is created

Is there a way to create a page model with a StreamField that has default blocks when a new page is created? For example I have this custom page: class CustomPage(Page): body = StreamField([("text", TextBlock())]) and I always want to have a…
movileanuv
  • 350
  • 1
  • 12
2
votes
1 answer

How to define custom template for Wagtail streamfield Document block?

We have a model defined with a StreamField that allows a DocumentChooserBlock as follows: class CustomPage(Page): body = StreamField( [("document", DocumentChooserBlock()),] ... Our page template renders the CustomPage.body field as…
Brylie Christopher Oxley
  • 1,684
  • 1
  • 17
  • 34
2
votes
0 answers

Generating nested streamblocks content programmatically in Wagtail

Currently struggling to generate content programmatically for the following StreamBlock: class SpecialistStreamBlock(blocks.StreamBlock): accordion = SpecialistAccordionBlock() class SpecialistAccordionBlock(BaseBlock): content =…
Vlax
  • 1,447
  • 1
  • 18
  • 24
2
votes
0 answers

wagtail get_api_representation() not called

I am using Streamfields in Wagtail and got the following problem: I would like to print out the image path instead of the id and followed the instructions here: Custom representation of Streamfield in rest API But it seems that…
2
votes
1 answer

Append an item to a streamfield in wagtail

I have a streamfield which is working, and has data in, the code I wrote to do this looks something like: class NewYearBlock(blocks.StructBlock): year = blocks.IntegerBlock(verbose_name="Year (the year this data is rolling into)") …
retrodans
  • 123
  • 1
  • 1
  • 9
2
votes
1 answer

How to truncatechars of wagtail streamfield block?

After reading all the docs, I still don't know how to truncatechars of a wagtail streamfield blocks. {% for block in post.body %} {% if block.block_type == 'richtext' %} {{ block.value|truncatechars:100 }} {% endif %} {% endfor…
1
2
3
11 12