@@ -53,10 +53,17 @@ class MyModel(models.Model):
5353 " description" : {" type" : " string" },
5454 " count" : {" type" : " integer" },
5555 },
56+ " required" : [" title" , " description" , " count" ],
5657 }
5758 )
5859```
5960
61+ ** Note!** `` required `` contains a list of properties which should exist in the
62+ JSON blob. The values themselves do not have to be truthy. The advantage of
63+ always specifying `` required `` is that the properties are automatically shown
64+ also when editing data which was added when those properties didn't all exist
65+ yet.
66+
6067### Rich Text Editing
6168
6269For rich text editing, use the ` prose ` format:
@@ -70,6 +77,7 @@ class MyModel(models.Model):
7077 " title" : {" type" : " string" },
7178 " content" : {" type" : " string" , " format" : " prose" },
7279 },
80+ " required" : [" title" , " content" ],
7381 }
7482 )
7583```
@@ -99,6 +107,7 @@ class MyModel(models.Model):
99107 }
100108 },
101109 },
110+ " required" : [" title" , " content" ],
102111 }
103112 )
104113```
@@ -127,6 +136,7 @@ class MyModel(models.Model):
127136 },
128137 },
129138 },
139+ " required" : [" title" , " image" ],
130140 }
131141 )
132142```
@@ -159,6 +169,7 @@ class Article(models.Model):
159169 },
160170 },
161171 },
172+ " required" : [" title" , " content" , " featured_image" ],
162173 }
163174 )
164175
0 commit comments