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
7
votes
2 answers

How to obtain database id from the struct_block.StructValue in the wagtail block template?

Building a custom template for the wagtail StreamField block I found myself in the situation that I need somehow pass the ID of the current block to the other views. For instance when the URL is clicked in the particular block, the landing page view…
NarūnasK
  • 4,564
  • 8
  • 50
  • 76
7
votes
2 answers

add/modify blocks value in wagtail streamfield from shell

I have a page with one StreamField body and a custom block named HeadingBlock: class HeadingBlock(blocks.StructBlock): heading = blocks.CharBlock() cssid = blocks.CharBlock() ... class CustomPage(Page): ... body = StreamField([ …
7
votes
1 answer

How to solve Wagtail cyclic Block dependency when using a StreamBlock

I would like to achieve something like this, from wagtail.wagtailcore.blocks import StreamBlock, StructBlock class CarouselBlock(StructBlock): content = StreamBlock([ ('tab', TabBlock()), ('carousel', CarouselBlock()) …
Mevin Babu
  • 2,405
  • 21
  • 34
7
votes
1 answer

Use of StreamField in Snippets on Wagtail

I am trying to build some structured snippets on my Wagtail site. I looked through the documentation, but saw nothing on this point (forgive me if I missed it). Is it possible to use StreamField inside of a Snippet? Or, only on Pages
Adam Hopkins
  • 6,837
  • 6
  • 32
  • 52
6
votes
1 answer

Supplying StreamField with default value in Wagtail admin interface

By default, wagtail's StreamField looks something like this in the admin for empty fields, showing the different blocks available for the user: I would however prefer it to contain a block of my choosing by default. For example: How would I…
cwj
  • 2,473
  • 5
  • 28
  • 38
6
votes
2 answers

How can I make a Wagtail Streamfield not required?

In the model below I want to make the bottom_content field in its entirety not required. How can I do this? class ServicePage(Page): top_content = StreamField(default_blocks + [ ('two_columns', TwoColumnBlock()), ('three_columns',…
NVN
  • 147
  • 2
  • 7
6
votes
2 answers

TableBlock how to specify table CSS classes

I am struggling to add CSS classes to Wagtail StreamField & TableBlock (http://docs.wagtail.io/en/v1.8.1/reference/contrib/table_block.html). Is the way to go to define a filter and use something like: {{ child|className:"table table-bordered"…
Dimitar Petrov
  • 667
  • 1
  • 5
  • 16
5
votes
1 answer

Using or reusing Wagtail StreamField blocks as Fields in other models

I have a Wagtail project with two different Page models that use identical gallery blocks, but in different ways. In one model, I want to use the gallery in a list of other freeform blocks; but in the other model there is only one gallery appearing…
axoplasm
  • 502
  • 2
  • 10
5
votes
1 answer

Wagtail getting/generating image urls from JSON api or directly

I've been using Wagtail as a headless CMS to use with a frontend application, However I noticed some limitations regarding images. Normally in your jinja template you would generate the correct image size you need and all is fine, However I don't…
Samuel
  • 540
  • 1
  • 4
  • 17
4
votes
0 answers

Inline creation of snippet in a streamfield block (Wagtail 2.3+)

so lets say I have the following models set up for Wagtail: @register_snippet class MySnippet(models.Model): name = models.CharField(max_length=200, null=True) panels = [FieldPanel('name'),] def __str__(self): return self.name …
thclark
  • 4,784
  • 3
  • 39
  • 65
4
votes
1 answer

Admin Interface Theme-ing?

I was wondering how themable the admin interface was? I ran across this doc and it seems to talk about a few options. It's huge step up from the django admin default interface but i was wondering if anyone knew of any drop in replacement. For…
csgeek
  • 270
  • 3
  • 19
4
votes
2 answers

Add StreamBlock child items programmatically in Wagtail

I have the following StructBlock and StreamBlock below: class AccordionItemBlock(StructBlock): title = CharBlock() text = RichTextBlock() class AccordionRepeaterBlock(StreamBlock): accordion_item = AccordionItemBlock() I need to…
Preston Horn
  • 231
  • 2
  • 9
4
votes
1 answer

Converting class object to readable value for get_api_representation function

Previous topic where I was kindly helped by @gasman so i have a model class ingredients like: @register_model_chooser class Ingredient(models.Model): name = models.CharField(max_length=255) def __str__(self): return self.name and to…
khashashin
  • 1,058
  • 14
  • 40
3
votes
0 answers

add/modify blocks value in wagtail streamfield with listblock from shell

I have a page with one StreamField body and a custom block named CardBlock: class CardBlock(blocks.StructBlock): title = blocks.CharBlock() description = blocks.CharBlock() ... class CardListBlock(blocks.StructBlock): cards =…
3
votes
1 answer

How to render Page attributes in a model when displayed in StreamField?

I have the following StructBlock and Page model: class PostGrid(blocks.StructBlock): title = blocks.CharBlock() post_1 = blocks.PageChooserBlock() post_2 = blocks.PageChooserBlock() class Meta: template =…
alias51
  • 8,178
  • 22
  • 94
  • 166
1
2 3
11 12