2
0

0001_initial.py 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. # -*- coding: utf-8 -*-
  2. # Generated by Django 1.10.5 on 2017-03-15 07:16
  3. from __future__ import unicode_literals
  4. import django.core.validators
  5. from django.db import migrations, models
  6. import django.db.models.deletion
  7. import modelcluster.fields
  8. import wagtail.blocks
  9. import wagtail.fields
  10. import wagtail.embeds.blocks
  11. import wagtail.images.blocks
  12. class Migration(migrations.Migration):
  13. initial = True
  14. dependencies = [
  15. ("wagtailcore", "0032_add_bulk_delete_page_permission"),
  16. ("wagtailimages", "0018_remove_rendition_filter"),
  17. ]
  18. operations = [
  19. migrations.CreateModel(
  20. name="LocationOperatingHours",
  21. fields=[
  22. (
  23. "id",
  24. models.AutoField(
  25. auto_created=True,
  26. primary_key=True,
  27. serialize=False,
  28. verbose_name="ID",
  29. ),
  30. ),
  31. (
  32. "sort_order",
  33. models.IntegerField(blank=True, editable=False, null=True),
  34. ),
  35. (
  36. "day",
  37. models.CharField(
  38. choices=[
  39. ("MON", "Monday"),
  40. ("TUES", "Tuesday"),
  41. ("WED", "Wednesday"),
  42. ("THUR", "Thursday"),
  43. ("FRI", "Friday"),
  44. ("SAT", "Saturday"),
  45. ("SUN", "Sunday"),
  46. ],
  47. default="MON",
  48. max_length=4,
  49. ),
  50. ),
  51. ("opening_time", models.TimeField(blank=True, null=True)),
  52. ("closing_time", models.TimeField(blank=True, null=True)),
  53. (
  54. "closed",
  55. models.BooleanField(
  56. help_text="Tick if location is closed on this day",
  57. verbose_name="Closed?",
  58. ),
  59. ),
  60. ],
  61. options={
  62. "ordering": ["sort_order"],
  63. "abstract": False,
  64. },
  65. ),
  66. migrations.CreateModel(
  67. name="LocationPage",
  68. fields=[
  69. (
  70. "page_ptr",
  71. models.OneToOneField(
  72. auto_created=True,
  73. on_delete=django.db.models.deletion.CASCADE,
  74. parent_link=True,
  75. primary_key=True,
  76. serialize=False,
  77. to="wagtailcore.Page",
  78. ),
  79. ),
  80. (
  81. "introduction",
  82. models.TextField(blank=True, help_text="Text to describe the page"),
  83. ),
  84. (
  85. "body",
  86. wagtail.fields.StreamField(
  87. (
  88. (
  89. "heading_block",
  90. wagtail.blocks.StructBlock(
  91. (
  92. (
  93. "heading_text",
  94. wagtail.blocks.CharBlock(
  95. classname="title", required=True
  96. ),
  97. ),
  98. (
  99. "size",
  100. wagtail.blocks.ChoiceBlock(
  101. blank=True,
  102. choices=[
  103. ("", "Select a header size"),
  104. ("h2", "H2"),
  105. ("h3", "H3"),
  106. ("h4", "H4"),
  107. ],
  108. required=False,
  109. ),
  110. ),
  111. )
  112. ),
  113. ),
  114. (
  115. "paragraph_block",
  116. wagtail.blocks.RichTextBlock(
  117. icon="pilcrow",
  118. template="blocks/paragraph_block.html",
  119. ),
  120. ),
  121. (
  122. "image_block",
  123. wagtail.blocks.StructBlock(
  124. (
  125. (
  126. "image",
  127. wagtail.images.blocks.ImageChooserBlock(
  128. required=True
  129. ),
  130. ),
  131. (
  132. "caption",
  133. wagtail.blocks.CharBlock(required=False),
  134. ),
  135. (
  136. "attribution",
  137. wagtail.blocks.CharBlock(required=False),
  138. ),
  139. )
  140. ),
  141. ),
  142. (
  143. "block_quote",
  144. wagtail.blocks.StructBlock(
  145. (
  146. ("text", wagtail.blocks.TextBlock()),
  147. (
  148. "attribute_name",
  149. wagtail.blocks.CharBlock(
  150. blank=True,
  151. label="e.g. Guy Picciotto",
  152. required=False,
  153. ),
  154. ),
  155. )
  156. ),
  157. ),
  158. (
  159. "embed_block",
  160. wagtail.embeds.blocks.EmbedBlock(
  161. help_text="Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks",
  162. icon="media",
  163. template="blocks/embed_block.html",
  164. ),
  165. ),
  166. ),
  167. blank=True,
  168. verbose_name="Page body",
  169. ),
  170. ),
  171. ("address", models.TextField()),
  172. (
  173. "lat_long",
  174. models.CharField(
  175. help_text="Comma separated lat/long. (Ex. 64.144367, -21.939182) Right click Google Maps and select 'What's Here'",
  176. max_length=36,
  177. validators=[
  178. django.core.validators.RegexValidator(
  179. code="invalid_lat_long",
  180. message="Lat Long must be a comma-separated numeric lat and long",
  181. regex="^(\\-?\\d+(\\.\\d+)?),\\s*(\\-?\\d+(\\.\\d+)?)$",
  182. )
  183. ],
  184. ),
  185. ),
  186. (
  187. "image",
  188. models.ForeignKey(
  189. blank=True,
  190. help_text="Landscape mode only; horizontal width between 1000px and 3000px.",
  191. null=True,
  192. on_delete=django.db.models.deletion.SET_NULL,
  193. related_name="+",
  194. to="wagtailimages.Image",
  195. ),
  196. ),
  197. ],
  198. options={
  199. "abstract": False,
  200. },
  201. bases=("wagtailcore.page", models.Model),
  202. ),
  203. migrations.CreateModel(
  204. name="LocationsIndexPage",
  205. fields=[
  206. (
  207. "page_ptr",
  208. models.OneToOneField(
  209. auto_created=True,
  210. on_delete=django.db.models.deletion.CASCADE,
  211. parent_link=True,
  212. primary_key=True,
  213. serialize=False,
  214. to="wagtailcore.Page",
  215. ),
  216. ),
  217. (
  218. "introduction",
  219. models.TextField(blank=True, help_text="Text to describe the page"),
  220. ),
  221. (
  222. "body",
  223. wagtail.fields.StreamField(
  224. (
  225. (
  226. "heading_block",
  227. wagtail.blocks.StructBlock(
  228. (
  229. (
  230. "heading_text",
  231. wagtail.blocks.CharBlock(
  232. classname="title", required=True
  233. ),
  234. ),
  235. (
  236. "size",
  237. wagtail.blocks.ChoiceBlock(
  238. blank=True,
  239. choices=[
  240. ("", "Select a header size"),
  241. ("h2", "H2"),
  242. ("h3", "H3"),
  243. ("h4", "H4"),
  244. ],
  245. required=False,
  246. ),
  247. ),
  248. )
  249. ),
  250. ),
  251. (
  252. "paragraph_block",
  253. wagtail.blocks.RichTextBlock(
  254. icon="pilcrow",
  255. template="blocks/paragraph_block.html",
  256. ),
  257. ),
  258. (
  259. "image_block",
  260. wagtail.blocks.StructBlock(
  261. (
  262. (
  263. "image",
  264. wagtail.images.blocks.ImageChooserBlock(
  265. required=True
  266. ),
  267. ),
  268. (
  269. "caption",
  270. wagtail.blocks.CharBlock(required=False),
  271. ),
  272. (
  273. "attribution",
  274. wagtail.blocks.CharBlock(required=False),
  275. ),
  276. )
  277. ),
  278. ),
  279. (
  280. "block_quote",
  281. wagtail.blocks.StructBlock(
  282. (
  283. ("text", wagtail.blocks.TextBlock()),
  284. (
  285. "attribute_name",
  286. wagtail.blocks.CharBlock(
  287. blank=True,
  288. label="e.g. Guy Picciotto",
  289. required=False,
  290. ),
  291. ),
  292. )
  293. ),
  294. ),
  295. (
  296. "embed_block",
  297. wagtail.embeds.blocks.EmbedBlock(
  298. help_text="Insert an embed URL e.g https://www.youtube.com/watch?v=SGJFWirQ3ks",
  299. icon="media",
  300. template="blocks/embed_block.html",
  301. ),
  302. ),
  303. ),
  304. blank=True,
  305. verbose_name="Page body",
  306. ),
  307. ),
  308. (
  309. "image",
  310. models.ForeignKey(
  311. blank=True,
  312. help_text="Landscape mode only; horizontal width between 1000px and 3000px.",
  313. null=True,
  314. on_delete=django.db.models.deletion.SET_NULL,
  315. related_name="+",
  316. to="wagtailimages.Image",
  317. ),
  318. ),
  319. ],
  320. options={
  321. "abstract": False,
  322. },
  323. bases=("wagtailcore.page", models.Model),
  324. ),
  325. migrations.AddField(
  326. model_name="locationoperatinghours",
  327. name="location",
  328. field=modelcluster.fields.ParentalKey(
  329. on_delete=django.db.models.deletion.CASCADE,
  330. related_name="hours_of_operation",
  331. to="locations.LocationPage",
  332. ),
  333. ),
  334. ]