2
0

0001_initial.py 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. # Generated by Django 4.1.4 on 2022-12-20 14:17
  2. from django.db import migrations, models
  3. import django.db.models.deletion
  4. import modelcluster.fields
  5. import wagtail.blocks
  6. import wagtail.contrib.table_block.blocks
  7. import wagtail.contrib.typed_table_block.blocks
  8. import wagtail.embeds.blocks
  9. import wagtail.fields
  10. import wagtail.images.blocks
  11. class Migration(migrations.Migration):
  12. initial = True
  13. dependencies = [
  14. ("base", "0012_person_expire_at_person_expired_and_more"),
  15. ("wagtailcore", "0078_referenceindex"),
  16. ]
  17. operations = [
  18. migrations.CreateModel(
  19. name="RecipeIndexPage",
  20. fields=[
  21. (
  22. "page_ptr",
  23. models.OneToOneField(
  24. auto_created=True,
  25. on_delete=django.db.models.deletion.CASCADE,
  26. parent_link=True,
  27. primary_key=True,
  28. serialize=False,
  29. to="wagtailcore.page",
  30. ),
  31. ),
  32. (
  33. "introduction",
  34. models.TextField(blank=True, help_text="Text to describe the page"),
  35. ),
  36. ],
  37. options={
  38. "abstract": False,
  39. },
  40. bases=("wagtailcore.page",),
  41. ),
  42. migrations.CreateModel(
  43. name="RecipePage",
  44. fields=[
  45. (
  46. "page_ptr",
  47. models.OneToOneField(
  48. auto_created=True,
  49. on_delete=django.db.models.deletion.CASCADE,
  50. parent_link=True,
  51. primary_key=True,
  52. serialize=False,
  53. to="wagtailcore.page",
  54. ),
  55. ),
  56. (
  57. "date_published",
  58. models.DateField(
  59. blank=True, null=True, verbose_name="Date article published"
  60. ),
  61. ),
  62. ("subtitle", models.CharField(blank=True, max_length=255)),
  63. ("introduction", models.TextField(blank=True, max_length=500)),
  64. (
  65. "backstory",
  66. wagtail.fields.StreamField(
  67. [
  68. (
  69. "heading_block",
  70. wagtail.blocks.StructBlock(
  71. [
  72. (
  73. "heading_text",
  74. wagtail.blocks.CharBlock(
  75. form_classname="title", required=True
  76. ),
  77. ),
  78. (
  79. "size",
  80. wagtail.blocks.ChoiceBlock(
  81. blank=True,
  82. choices=[
  83. ("", "Select a header size"),
  84. ("h2", "H2"),
  85. ("h3", "H3"),
  86. ("h4", "H4"),
  87. ],
  88. required=False,
  89. ),
  90. ),
  91. ]
  92. ),
  93. ),
  94. (
  95. "paragraph_block",
  96. wagtail.blocks.RichTextBlock(
  97. icon="pilcrow",
  98. template="blocks/paragraph_block.html",
  99. ),
  100. ),
  101. (
  102. "image_block",
  103. wagtail.blocks.StructBlock(
  104. [
  105. (
  106. "image",
  107. wagtail.images.blocks.ImageChooserBlock(
  108. required=True
  109. ),
  110. ),
  111. (
  112. "caption",
  113. wagtail.blocks.CharBlock(required=False),
  114. ),
  115. (
  116. "attribution",
  117. wagtail.blocks.CharBlock(required=False),
  118. ),
  119. ]
  120. ),
  121. ),
  122. (
  123. "block_quote",
  124. wagtail.blocks.StructBlock(
  125. [
  126. ("text", wagtail.blocks.TextBlock()),
  127. (
  128. "attribute_name",
  129. wagtail.blocks.CharBlock(
  130. blank=True,
  131. label="e.g. Mary Berry",
  132. required=False,
  133. ),
  134. ),
  135. ]
  136. ),
  137. ),
  138. (
  139. "embed_block",
  140. wagtail.embeds.blocks.EmbedBlock(
  141. help_text="Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks",
  142. icon="media",
  143. template="blocks/embed_block.html",
  144. ),
  145. ),
  146. ],
  147. blank=True,
  148. help_text="Use only a minimum number of headings and large blocks.",
  149. use_json_field=True,
  150. ),
  151. ),
  152. (
  153. "recipe_headline",
  154. wagtail.fields.RichTextField(
  155. blank=True, help_text="Keep to a single line", max_length=120
  156. ),
  157. ),
  158. (
  159. "body",
  160. wagtail.fields.StreamField(
  161. [
  162. (
  163. "heading_block",
  164. wagtail.blocks.StructBlock(
  165. [
  166. (
  167. "heading_text",
  168. wagtail.blocks.CharBlock(
  169. form_classname="title", required=True
  170. ),
  171. ),
  172. (
  173. "size",
  174. wagtail.blocks.ChoiceBlock(
  175. blank=True,
  176. choices=[
  177. ("", "Select a header size"),
  178. ("h2", "H2"),
  179. ("h3", "H3"),
  180. ("h4", "H4"),
  181. ],
  182. required=False,
  183. ),
  184. ),
  185. ],
  186. group="Content",
  187. ),
  188. ),
  189. (
  190. "paragraph_block",
  191. wagtail.blocks.RichTextBlock(
  192. group="Content",
  193. icon="pilcrow",
  194. template="blocks/paragraph_block.html",
  195. ),
  196. ),
  197. (
  198. "block_quote",
  199. wagtail.blocks.StructBlock(
  200. [
  201. ("text", wagtail.blocks.TextBlock()),
  202. (
  203. "attribute_name",
  204. wagtail.blocks.CharBlock(
  205. blank=True,
  206. label="e.g. Mary Berry",
  207. required=False,
  208. ),
  209. ),
  210. ],
  211. group="Content",
  212. ),
  213. ),
  214. (
  215. "table_block",
  216. wagtail.contrib.table_block.blocks.TableBlock(
  217. group="Content"
  218. ),
  219. ),
  220. (
  221. "typed_table_block",
  222. wagtail.contrib.typed_table_block.blocks.TypedTableBlock(
  223. [
  224. ("text", wagtail.blocks.CharBlock()),
  225. ("numeric", wagtail.blocks.FloatBlock()),
  226. ("rich_text", wagtail.blocks.RichTextBlock()),
  227. (
  228. "image",
  229. wagtail.images.blocks.ImageChooserBlock(),
  230. ),
  231. ],
  232. group="Content",
  233. ),
  234. ),
  235. (
  236. "image_block",
  237. wagtail.blocks.StructBlock(
  238. [
  239. (
  240. "image",
  241. wagtail.images.blocks.ImageChooserBlock(
  242. required=True
  243. ),
  244. ),
  245. (
  246. "caption",
  247. wagtail.blocks.CharBlock(required=False),
  248. ),
  249. (
  250. "attribution",
  251. wagtail.blocks.CharBlock(required=False),
  252. ),
  253. ],
  254. group="Media",
  255. ),
  256. ),
  257. (
  258. "embed_block",
  259. wagtail.embeds.blocks.EmbedBlock(
  260. group="Media",
  261. help_text="Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks",
  262. icon="media",
  263. template="blocks/embed_block.html",
  264. ),
  265. ),
  266. (
  267. "ingredients_list",
  268. wagtail.blocks.ListBlock(
  269. wagtail.blocks.RichTextBlock(
  270. features=["bold", "italic", "link"]
  271. ),
  272. group="Cooking",
  273. icon="list-ol",
  274. max_num=10,
  275. min_num=2,
  276. ),
  277. ),
  278. (
  279. "steps_list",
  280. wagtail.blocks.ListBlock(
  281. wagtail.blocks.StructBlock(
  282. [
  283. (
  284. "text",
  285. wagtail.blocks.RichTextBlock(
  286. features=["bold", "italic", "link"]
  287. ),
  288. ),
  289. (
  290. "difficulty",
  291. wagtail.blocks.ChoiceBlock(
  292. choices=[
  293. ("S", "Small"),
  294. ("M", "Medium"),
  295. ("L", "Large"),
  296. ]
  297. ),
  298. ),
  299. ]
  300. ),
  301. group="Cooking",
  302. icon="tasks",
  303. max_num=10,
  304. min_num=2,
  305. ),
  306. ),
  307. ],
  308. blank=True,
  309. help_text="The recipe’s step-by-step instructions and any other relevant information.",
  310. use_json_field=True,
  311. ),
  312. ),
  313. ],
  314. options={
  315. "abstract": False,
  316. },
  317. bases=("wagtailcore.page",),
  318. ),
  319. migrations.CreateModel(
  320. name="RecipePersonRelationship",
  321. fields=[
  322. (
  323. "id",
  324. models.AutoField(
  325. auto_created=True,
  326. primary_key=True,
  327. serialize=False,
  328. verbose_name="ID",
  329. ),
  330. ),
  331. (
  332. "sort_order",
  333. models.IntegerField(blank=True, editable=False, null=True),
  334. ),
  335. (
  336. "page",
  337. modelcluster.fields.ParentalKey(
  338. on_delete=django.db.models.deletion.CASCADE,
  339. related_name="recipe_person_relationship",
  340. to="recipes.recipepage",
  341. ),
  342. ),
  343. (
  344. "person",
  345. models.ForeignKey(
  346. on_delete=django.db.models.deletion.CASCADE,
  347. related_name="person_recipe_relationship",
  348. to="base.person",
  349. ),
  350. ),
  351. ],
  352. options={
  353. "ordering": ["sort_order"],
  354. "abstract": False,
  355. },
  356. ),
  357. ]