Рет қаралды 6,520
There will be times when you need to provide multiple optional fields in a StreamField, and naturally we lean towards using logic in the template. In this video we're going to learn how to pull out template logic and use Python instead. In this example we'll be using a StructValue and StructBlock to return a single URL in the template even though the StreamField has a PageChooserBlock and a URLBlock (pick one and return it).
Tutorial: learnwagtail.c...
GitHub Commit: github.com/Cod...
Learn Wagtail from scratch with the official Wagtail for Beginners Course
learnwagtail.c...
Used in this video: Wagtail 2.4, Python 3.7, Django 2.1.5 #Wagtail #Django #Python