0001_initial.py 14 KB

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