Headless Wagtail CMS: Custom Image Serializers

  Рет қаралды 3,112

Coding For Everybody

Coding For Everybody

Күн бұрын

While working with Wagtail's v2 API, sometimes you'll run into a scenario where you need to serialize (turn model fields into JSON) on your own. Wagtail's API will handle as much of it as it possibly can, but it's impossible to know every possible situation. That's where Django Rest Framework comes in.
Using Django Rest Framework with Wagtails v2 API, we can customize ANY field the way we want. In this short video, we take a look at creating a new field entirely by overwriting an image, but we also look at serializing (JSONifying) an image field from a ForeignKey inside an Orderable. Don't worry, it's not as crazy as it sounds!
Tutorial: learnwagtail.c...
Learn Wagtail from scratch with the official Wagtail for Beginners Course
learnwagtail.c...
Git Commit: github.com/Cod...
Used in this video: Wagtail 2.4, Python 3.7, Django 2.1.5
Outro Template made by Grabster - / grabstertv #Wagtail #Django #Python

Пікірлер: 2
@AyazAmlani
@AyazAmlani 5 жыл бұрын
I like how you showed the dict first. Crazy how you know all of this.
@goneforawander_com
@goneforawander_com 3 жыл бұрын
I got a bit lost trying to get details for an image that's part of a StructBlock in a StreamField. I tried adding an APIField to the custom StructBlock definition, but when I get the serialized data for the streamfield, it just shows the basic data for the image (ie the foreign key only). How would you go about exposing the image data in this case?
How to Use ListBlocks in Wagtail CMS to Create Repeating StreamField Content
19:52
Headless Wagtail CMS: Wagtails Built In Image Rendition Field
9:07
Coding For Everybody
Рет қаралды 2,6 М.
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
pumpkins #shorts
00:39
Mr DegrEE
Рет қаралды 74 МЛН
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 120 МЛН
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 73 МЛН
FastAPI Course for Beginners
1:04:33
freeCodeCamp.org
Рет қаралды 331 М.
How to use Orderables in Wagtail CMS
22:42
Coding For Everybody
Рет қаралды 14 М.
Wagtail CMS: How to Create a Custom Wagtail Menu System
38:22
Coding For Everybody
Рет қаралды 20 М.
How to Upload an Image Using Django ImageField (The RIGHT Way)
20:03
Top REST API Design Pitfalls
1:21:26
Victor Rentea
Рет қаралды 2,7 М.
Wagtail Headless CMS Workshop (with Vue.js)
59:03
Coding For Everybody
Рет қаралды 17 М.
Registering Django Models with Wagtails ModelAdmin
12:17
Coding For Everybody
Рет қаралды 13 М.
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33