django-spire 0.17.11__py3-none-any.whl → 0.18.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. django_spire/consts.py +1 -1
  2. django_spire/contrib/seeding/model/base.py +1 -1
  3. django_spire/knowledge/entry/services/automation_service.py +7 -4
  4. django_spire/knowledge/entry/services/transformation_services.py +2 -2
  5. django_spire/knowledge/entry/version/block/choices.py +1 -2
  6. django_spire/knowledge/entry/version/block/data/data.py +33 -0
  7. django_spire/knowledge/entry/version/block/data/heading_data.py +15 -0
  8. django_spire/knowledge/entry/version/block/data/list/choices.py +17 -0
  9. django_spire/knowledge/entry/version/block/data/list/data.py +102 -0
  10. django_spire/knowledge/entry/version/block/data/list/maps.py +14 -0
  11. django_spire/knowledge/entry/version/block/data/list/meta.py +15 -0
  12. django_spire/knowledge/entry/version/block/data/maps.py +23 -0
  13. django_spire/knowledge/entry/version/block/data/text_data.py +13 -0
  14. django_spire/knowledge/entry/version/block/models.py +22 -14
  15. django_spire/knowledge/entry/version/block/querysets.py +17 -7
  16. django_spire/knowledge/entry/version/block/seeding/constants.py +271 -188
  17. django_spire/knowledge/entry/version/block/services/factory_service.py +14 -47
  18. django_spire/knowledge/entry/version/block/services/service.py +2 -12
  19. django_spire/knowledge/entry/version/block/tests/factories.py +18 -2
  20. django_spire/knowledge/entry/version/converters/markdown_converter.py +180 -105
  21. django_spire/knowledge/entry/version/maps.py +1 -1
  22. django_spire/knowledge/entry/version/models.py +1 -0
  23. django_spire/knowledge/entry/version/querysets.py +11 -1
  24. django_spire/knowledge/entry/version/seeding/seeder.py +4 -2
  25. django_spire/knowledge/entry/version/services/processor_service.py +18 -0
  26. django_spire/knowledge/entry/version/services/tests/test_processor_service.py +0 -0
  27. django_spire/knowledge/entry/version/tests/test_urls/test_json_urls.py +7 -24
  28. django_spire/knowledge/entry/version/urls/__init__.py +0 -3
  29. django_spire/knowledge/entry/version/urls/json_urls.py +5 -13
  30. django_spire/knowledge/entry/version/views/json_views.py +8 -76
  31. django_spire/knowledge/entry/version/views/page_views.py +10 -5
  32. django_spire/knowledge/migrations/0005_entryversionblock__tunes_data_and_more.py +23 -0
  33. django_spire/knowledge/static/django_spire/knowledge/css/navigation_items.css +1 -1
  34. django_spire/knowledge/static/django_spire/knowledge/entry/version/js/editor.js +87 -0
  35. django_spire/knowledge/static/django_spire/knowledge/entry/version/js/null_paragraph.js +15 -0
  36. django_spire/knowledge/templates/django_spire/knowledge/entry/file/page/list_page.html +1 -1
  37. django_spire/knowledge/templates/django_spire/knowledge/entry/version/container/detail_container.html +43 -12
  38. django_spire/knowledge/templates/django_spire/knowledge/entry/version/page/detail_page.html +17 -1
  39. django_spire/knowledge/templates/django_spire/knowledge/navigation/page/full_page.html +1 -1
  40. {django_spire-0.17.11.dist-info → django_spire-0.18.0.dist-info}/METADATA +2 -1
  41. {django_spire-0.17.11.dist-info → django_spire-0.18.0.dist-info}/RECORD +47 -60
  42. django_spire/knowledge/entry/version/block/blocks/block.py +0 -51
  43. django_spire/knowledge/entry/version/block/blocks/heading_block.py +0 -14
  44. django_spire/knowledge/entry/version/block/blocks/list_block.py +0 -31
  45. django_spire/knowledge/entry/version/block/blocks/sub_heading_block.py +0 -14
  46. django_spire/knowledge/entry/version/block/blocks/text_block.py +0 -14
  47. django_spire/knowledge/entry/version/block/maps.py +0 -16
  48. django_spire/knowledge/entry/version/block/services/processor_service.py +0 -33
  49. django_spire/knowledge/entry/version/block/services/transformation_service.py +0 -35
  50. django_spire/knowledge/entry/version/block/tests/test_urls/test_json_urls.py +0 -28
  51. django_spire/knowledge/entry/version/block/urls/__init__.py +0 -13
  52. django_spire/knowledge/entry/version/block/urls/json_urls.py +0 -9
  53. django_spire/knowledge/entry/version/block/views/json_views.py +0 -30
  54. django_spire/knowledge/entry/version/tests/test_urls/test_form_urls.py +0 -28
  55. django_spire/knowledge/entry/version/urls/form_urls.py +0 -10
  56. django_spire/knowledge/entry/version/views/form_views.py +0 -63
  57. django_spire/knowledge/templates/django_spire/knowledge/entry/version/block/detail/component/heading_component.html +0 -3
  58. django_spire/knowledge/templates/django_spire/knowledge/entry/version/block/detail/component/list_item_component.html +0 -38
  59. django_spire/knowledge/templates/django_spire/knowledge/entry/version/block/detail/component/sub_heading_component.html +0 -3
  60. django_spire/knowledge/templates/django_spire/knowledge/entry/version/block/detail/component/text_component.html +0 -3
  61. django_spire/knowledge/templates/django_spire/knowledge/entry/version/block/dropdown/add_dropdown.html +0 -25
  62. django_spire/knowledge/templates/django_spire/knowledge/entry/version/block/update/component/heading_component.html +0 -3
  63. django_spire/knowledge/templates/django_spire/knowledge/entry/version/block/update/component/list_item_component.html +0 -13
  64. django_spire/knowledge/templates/django_spire/knowledge/entry/version/block/update/component/sub_heading_component.html +0 -3
  65. django_spire/knowledge/templates/django_spire/knowledge/entry/version/block/update/component/text_component.html +0 -50
  66. django_spire/knowledge/templates/django_spire/knowledge/entry/version/container/form_container.html +0 -129
  67. /django_spire/knowledge/entry/version/block/{blocks → data}/__init__.py +0 -0
  68. /django_spire/knowledge/entry/version/block/{tests/test_urls → data/list}/__init__.py +0 -0
  69. /django_spire/knowledge/entry/version/{block/views → services/tests}/__init__.py +0 -0
  70. {django_spire-0.17.11.dist-info → django_spire-0.18.0.dist-info}/WHEEL +0 -0
  71. {django_spire-0.17.11.dist-info → django_spire-0.18.0.dist-info}/licenses/LICENSE.md +0 -0
  72. {django_spire-0.17.11.dist-info → django_spire-0.18.0.dist-info}/top_level.txt +0 -0
@@ -1,220 +1,303 @@
1
- from django_spire.knowledge.entry.version.block.blocks.heading_block import HeadingBlock
2
- from django_spire.knowledge.entry.version.block.blocks.sub_heading_block import \
3
- SubHeadingBlock
4
- from django_spire.knowledge.entry.version.block.blocks.text_block import TextBlock
5
-
1
+ from django_spire.knowledge.entry.version.block.data.heading_data import \
2
+ HeadingEditorBlockData
3
+ from django_spire.knowledge.entry.version.block.data.text_data import \
4
+ TextEditorBlockData
6
5
 
7
6
  LADDER_SAFETY_BLOCKS = [
8
- HeadingBlock(value='Ladder Safety: A Journey Through the Heights'),
9
- TextBlock(value=''),
10
- SubHeadingBlock(value='The Great Ladder Adventure Begins'),
11
- TextBlock(value='Welcome to the thrilling world of ladder safety! Grab your hard hats and let\'s explore the wonderful dangers of working at heights.'),
12
- TextBlock(value='Whether you\'re a seasoned climber or a first-time ladder user, this guide will help you navigate the exciting landscape of aerial safety.'),
13
- TextBlock(value=''),
14
- SubHeadingBlock(value='High vs. Low: The Ladder Tightrope'),
15
- TextBlock(value='High ladders are like climbing Mount Everest - exciting but dangerous! Always double-check your footing and support.'),
16
- TextBlock(value='Low ladders might seem harmless, but they\'re like slippery snakes waiting to trip you up! Keep them out of high-traffic areas.'),
17
- TextBlock(value=''),
18
- SubHeadingBlock(value='The Ladder Safety Toolkit'),
19
- TextBlock(value='Inspect your ladder like a detective looking for clues - check for cracks, rust, or missing rungs.'),
20
- TextBlock(value='Remember: Three points of contact keeps you safe and sound!'),
21
- TextBlock(value='Never exceed the weight limit - your ladder has a maximum capacity just like you have a maximum capacity for pizza!'),
22
- TextBlock(value=''),
23
- SubHeadingBlock(value='Emergency: The Ladder Rescue Mission'),
24
- TextBlock(value='If you find yourself in a precarious situation, stay calm and follow the emergency protocols.'),
25
- TextBlock(value='First aid training is like having a superhero power - it\'s invaluable when you need it most!'),
26
- TextBlock(value=''),
27
- SubHeadingBlock(value='The Ladder Safety Certificate'),
28
- TextBlock(value='Congratulations! You\'ve completed your ladder safety course. Now go out there and climb with confidence!'),
7
+ HeadingEditorBlockData(text='Ladder Safety: A Journey Through the Heights',
8
+ level=1),
9
+ TextEditorBlockData(text=''),
10
+ HeadingEditorBlockData(text='The Great Ladder Adventure Begins', level=2),
11
+ TextEditorBlockData(
12
+ text='Welcome to the thrilling world of ladder safety! Grab your hard hats and let\'s explore the wonderful dangers of working at heights.'),
13
+ TextEditorBlockData(
14
+ text='Whether you\'re a seasoned climber or a first-time ladder user, this guide will help you navigate the exciting landscape of aerial safety.'),
15
+ TextEditorBlockData(text=''),
16
+ HeadingEditorBlockData(text='High vs. Low: The Ladder Tightrope', level=2),
17
+ TextEditorBlockData(
18
+ text='High ladders are like climbing Mount Everest - exciting but dangerous! Always double-check your footing and support.'),
19
+ TextEditorBlockData(
20
+ text='Low ladders might seem harmless, but they\'re like slippery snakes waiting to trip you up! Keep them out of high-traffic areas.'),
21
+ TextEditorBlockData(text=''),
22
+ HeadingEditorBlockData(text='The Ladder Safety Toolkit', level=2),
23
+ TextEditorBlockData(
24
+ text='Inspect your ladder like a detective looking for clues - check for cracks, rust, or missing rungs.'),
25
+ TextEditorBlockData(
26
+ text='Remember: Three points of contact keeps you safe and sound!'),
27
+ TextEditorBlockData(
28
+ text='Never exceed the weight limit - your ladder has a maximum capacity just like you have a maximum capacity for pizza!'),
29
+ TextEditorBlockData(text=''),
30
+ HeadingEditorBlockData(text='Emergency: The Ladder Rescue Mission', level=2),
31
+ TextEditorBlockData(
32
+ text='If you find yourself in a precarious situation, stay calm and follow the emergency protocols.'),
33
+ TextEditorBlockData(
34
+ text='First aid training is like having a superhero power - it\'s invaluable when you need it most!'),
35
+ TextEditorBlockData(text=''),
36
+ HeadingEditorBlockData(text='The Ladder Safety Certificate', level=2),
37
+ TextEditorBlockData(
38
+ text='Congratulations! You\'ve completed your ladder safety course. Now go out there and climb with confidence!'),
29
39
  ]
30
40
 
31
41
  KITCHEN_SAFETY_BLOCKS = [
32
- TextBlock(value=''),
33
- HeadingBlock(value='Kitchen Safety: A Culinary Adventure'),
34
- TextBlock(value=''),
35
- SubHeadingBlock(value='The Great Kitchen Escape'),
36
- TextBlock(value='Welcome to the thrilling world of kitchen safety! Every chef needs to know how to navigate the kitchen without getting burned, cut, or startled by hot oil.'),
37
- TextBlock(value='Whether you\'re a professional chef or a home cook, these safety tips will help you avoid kitchen disasters and keep your cooking adventures safe.'),
38
- TextBlock(value=''),
39
- SubHeadingBlock(value='Hot Oil: The Dangerous Dance'),
40
- TextBlock(value='Hot oil is like a wild animal - it can splash and burn in seconds! Always use proper protective gear when handling hot oil.'),
41
- TextBlock(value='Never leave hot oil unattended, or you\'ll end up with a kitchen fire that\'s more exciting than your favorite TV show!'),
42
- TextBlock(value=''),
43
- SubHeadingBlock(value='Knife Safety: The Sharp Edge of Responsibility'),
44
- TextBlock(value='Knives are like any other tool - they\'re only as dangerous as the person using them.'),
45
- TextBlock(value='Always cut away from your body and keep your knives sharp (dull knives are actually more dangerous than sharp ones).'),
46
- TextBlock(value=''),
47
- SubHeadingBlock(value='Emergency Kitchen Procedures'),
48
- TextBlock(value='If you encounter a kitchen emergency, stay calm and follow established protocols.'),
49
- TextBlock(value='Having a fire extinguisher in the kitchen is like having a superhero sidekick - it\'s always good to have backup!'),
42
+ TextEditorBlockData(text=''),
43
+ HeadingEditorBlockData(text='Kitchen Safety: A Culinary Adventure', level=1),
44
+ TextEditorBlockData(text=''),
45
+ HeadingEditorBlockData(text='The Great Kitchen Escape', level=2),
46
+ TextEditorBlockData(
47
+ text='Welcome to the thrilling world of kitchen safety! Every chef needs to know how to navigate the kitchen without getting burned, cut, or startled by hot oil.'),
48
+ TextEditorBlockData(
49
+ text='Whether you\'re a professional chef or a home cook, these safety tips will help you avoid kitchen disasters and keep your cooking adventures safe.'),
50
+ TextEditorBlockData(text=''),
51
+ HeadingEditorBlockData(text='Hot Oil: The Dangerous Dance', level=2),
52
+ TextEditorBlockData(
53
+ text='Hot oil is like a wild animal - it can splash and burn in seconds! Always use proper protective gear when handling hot oil.'),
54
+ TextEditorBlockData(
55
+ text='Never leave hot oil unattended, or you\'ll end up with a kitchen fire that\'s more exciting than your favorite TV show!'),
56
+ TextEditorBlockData(text=''),
57
+ HeadingEditorBlockData(text='Knife Safety: The Sharp Edge of Responsibility',
58
+ level=2),
59
+ TextEditorBlockData(
60
+ text='Knives are like any other tool - they\'re only as dangerous as the person using them.'),
61
+ TextEditorBlockData(
62
+ text='Always cut away from your body and keep your knives sharp (dull knives are actually more dangerous than sharp ones).'),
63
+ TextEditorBlockData(text=''),
64
+ HeadingEditorBlockData(text='Emergency Kitchen Procedures', level=2),
65
+ TextEditorBlockData(
66
+ text='If you encounter a kitchen emergency, stay calm and follow established protocols.'),
67
+ TextEditorBlockData(
68
+ text='Having a fire extinguisher in the kitchen is like having a superhero sidekick - it\'s always good to have backup!'),
50
69
  ]
51
70
 
52
71
  GARDEN_SAFETY_BLOCKS = [
53
- TextBlock(value=''),
54
- HeadingBlock(value='Garden Safety: A Green Thumb Guide'),
55
- TextBlock(value=''),
56
- SubHeadingBlock(value='The Garden Adventure Begins'),
57
- TextBlock(value='Step into the wonderful world of gardening with safety as your companion! Every gardener should know how to protect themselves from thorns, chemicals, and unexpected wildlife.'),
58
- TextBlock(value='Whether you\'re tending to a small potted plant or a large garden, these tips will keep you safe while you nurture your green thumb.'),
59
- TextBlock(value=''),
60
- SubHeadingBlock(value='Chemical Safety: The Poisonous Garden'),
61
- TextBlock(value='Gardening chemicals can be like hidden traps - they look harmless but can cause serious harm if not handled properly.'),
62
- TextBlock(value='Always read labels and wear protective gear when working with fertilizers, pesticides, or other garden chemicals.'),
63
- TextBlock(value=''),
64
- SubHeadingBlock(value='Tool Safety: The Gardener\'s Arsenal'),
65
- TextBlock(value='Gardening tools are like weapons - they\'re only as dangerous as the person wielding them.'),
66
- TextBlock(value='Keep your tools sharp and clean to prevent accidents and ensure maximum efficiency in your garden work.'),
67
- TextBlock(value=''),
68
- SubHeadingBlock(value='Emergency Garden Procedures'),
69
- TextBlock(value='If you encounter a garden emergency, stay calm and follow established protocols.'),
70
- TextBlock(value='Having a first aid kit in the garden is like having a superhero sidekick - it\'s always good to have backup!'),
72
+ TextEditorBlockData(text=''),
73
+ HeadingEditorBlockData(text='Garden Safety: A Green Thumb Guide', level=1),
74
+ TextEditorBlockData(text=''),
75
+ HeadingEditorBlockData(text='The Garden Adventure Begins', level=2),
76
+ TextEditorBlockData(
77
+ text='Step into the wonderful world of gardening with safety as your companion! Every gardener should know how to protect themselves from thorns, chemicals, and unexpected wildlife.'),
78
+ TextEditorBlockData(
79
+ text='Whether you\'re tending to a small potted plant or a large garden, these tips will keep you safe while you nurture your green thumb.'),
80
+ TextEditorBlockData(text=''),
81
+ HeadingEditorBlockData(text='Chemical Safety: The Poisonous Garden', level=2),
82
+ TextEditorBlockData(
83
+ text='Gardening chemicals can be like hidden traps - they look harmless but can cause serious harm if not handled properly.'),
84
+ TextEditorBlockData(
85
+ text='Always read labels and wear protective gear when working with fertilizers, pesticides, or other garden chemicals.'),
86
+ TextEditorBlockData(text=''),
87
+ HeadingEditorBlockData(text='Tool Safety: The Gardener\'s Arsenal', level=2),
88
+ TextEditorBlockData(
89
+ text='Gardening tools are like weapons - they\'re only as dangerous as the person wielding them.'),
90
+ TextEditorBlockData(
91
+ text='Keep your tools sharp and clean to prevent accidents and ensure maximum efficiency in your garden work.'),
92
+ TextEditorBlockData(text=''),
93
+ HeadingEditorBlockData(text='Emergency Garden Procedures', level=2),
94
+ TextEditorBlockData(
95
+ text='If you encounter a garden emergency, stay calm and follow established protocols.'),
96
+ TextEditorBlockData(
97
+ text='Having a first aid kit in the garden is like having a superhero sidekick - it\'s always good to have backup!'),
71
98
  ]
72
99
 
73
100
  OFFICE_SAFETY_BLOCKS = [
74
- TextBlock(value=''),
75
- HeadingBlock(value='Office Safety: A Professional Adventure'),
76
- TextBlock(value=''),
77
- SubHeadingBlock(value='The Office Escape'),
78
- TextBlock(value='Welcome to the exciting world of office safety! Every professional should know how to navigate their workspace without tripping, falling, or getting distracted by a rogue cable.'),
79
- TextBlock(value='Whether you\'re working in a bustling office or a quiet cubicle, these safety tips will help you avoid workplace disasters and keep your productivity high.'),
80
- TextBlock(value=''),
81
- SubHeadingBlock(value='Cable Safety: The Hidden Danger'),
82
- TextBlock(value='Office cables are like snakes waiting to strike - they can trip you up if you\'re not careful!'),
83
- TextBlock(value='Always secure cables properly and keep walkways clear of obstacles.'),
84
- TextBlock(value=''),
85
- SubHeadingBlock(value='Ergonomic Safety: The Comfort Zone'),
86
- TextBlock(value='Proper ergonomics in the office are like having a personal assistant - they make everything easier and more comfortable.'),
87
- TextBlock(value='Adjust your chair, monitor, and keyboard to prevent strain and injury.'),
88
- TextBlock(value=''),
89
- SubHeadingBlock(value='Emergency Office Procedures'),
90
- TextBlock(value='If you encounter an office emergency, stay calm and follow established protocols.'),
91
- TextBlock(value='Having a fire extinguisher in the office is like having a superhero sidekick - it\'s always good to have backup!'),
101
+ TextEditorBlockData(text=''),
102
+ HeadingEditorBlockData(text='Office Safety: A Professional Adventure', level=1),
103
+ TextEditorBlockData(text=''),
104
+ HeadingEditorBlockData(text='The Office Escape', level=2),
105
+ TextEditorBlockData(
106
+ text='Welcome to the exciting world of office safety! Every professional should know how to navigate their workspace without tripping, falling, or getting distracted by a rogue cable.'),
107
+ TextEditorBlockData(
108
+ text='Whether you\'re working in a bustling office or a quiet cubicle, these safety tips will help you avoid workplace disasters and keep your productivity high.'),
109
+ TextEditorBlockData(text=''),
110
+ HeadingEditorBlockData(text='Cable Safety: The Hidden Danger', level=2),
111
+ TextEditorBlockData(
112
+ text='Office cables are like snakes waiting to strike - they can trip you up if you\'re not careful!'),
113
+ TextEditorBlockData(
114
+ text='Always secure cables properly and keep walkways clear of obstacles.'),
115
+ TextEditorBlockData(text=''),
116
+ HeadingEditorBlockData(text='Ergonomic Safety: The Comfort Zone', level=2),
117
+ TextEditorBlockData(
118
+ text='Proper ergonomics in the office are like having a personal assistant - they make everything easier and more comfortable.'),
119
+ TextEditorBlockData(
120
+ text='Adjust your chair, monitor, and keyboard to prevent strain and injury.'),
121
+ TextEditorBlockData(text=''),
122
+ HeadingEditorBlockData(text='Emergency Office Procedures', level=2),
123
+ TextEditorBlockData(
124
+ text='If you encounter an office emergency, stay calm and follow established protocols.'),
125
+ TextEditorBlockData(
126
+ text='Having a fire extinguisher in the office is like having a superhero sidekick - it\'s always good to have backup!'),
92
127
  ]
93
128
 
94
129
  POOL_SAFETY_BLOCKS = [
95
- TextBlock(value=''),
96
- HeadingBlock(value='Swimming Pool Safety: A Water Adventure'),
97
- TextBlock(value=''),
98
- SubHeadingBlock(value='The Pool Party Begins'),
99
- TextBlock(value='Dive into the exciting world of pool safety! Every swimmer should know how to protect themselves from drowning, sunburn, and unexpected water hazards.'),
100
- TextBlock(value='Whether you\'re swimming in a backyard pool or a public facility, these tips will keep you safe while you enjoy the water.'),
101
- TextBlock(value=''),
102
- SubHeadingBlock(value='Water Safety: The Deep End'),
103
- TextBlock(value='Pool water can be deceiving - it looks calm but can hide dangerous situations!'),
104
- TextBlock(value='Always swim with a buddy and never dive into shallow water.'),
105
- TextBlock(value=''),
106
- SubHeadingBlock(value='Sun Protection: The Beach Adventure'),
107
- TextBlock(value='Sun exposure is like a wild animal - it can burn you in seconds!'),
108
- TextBlock(value='Apply sunscreen regularly and wear protective clothing to avoid sunburn and skin damage.'),
109
- TextBlock(value=''),
110
- SubHeadingBlock(value='Emergency Pool Procedures'),
111
- TextBlock(value='If you encounter a pool emergency, stay calm and follow established protocols.'),
112
- TextBlock(value='Having lifeguards on duty is like having a superhero sidekick - it\'s always good to have backup!'),
130
+ TextEditorBlockData(text=''),
131
+ HeadingEditorBlockData(text='Swimming Pool Safety: A Water Adventure', level=1),
132
+ TextEditorBlockData(text=''),
133
+ HeadingEditorBlockData(text='The Pool Party Begins', level=2),
134
+ TextEditorBlockData(
135
+ text='Dive into the exciting world of pool safety! Every swimmer should know how to protect themselves from drowning, sunburn, and unexpected water hazards.'),
136
+ TextEditorBlockData(
137
+ text='Whether you\'re swimming in a backyard pool or a public facility, these tips will keep you safe while you enjoy the water.'),
138
+ TextEditorBlockData(text=''),
139
+ HeadingEditorBlockData(text='Water Safety: The Deep End', level=2),
140
+ TextEditorBlockData(
141
+ text='Pool water can be deceiving - it looks calm but can hide dangerous situations!'),
142
+ TextEditorBlockData(
143
+ text='Always swim with a buddy and never dive into shallow water.'),
144
+ TextEditorBlockData(text=''),
145
+ HeadingEditorBlockData(text='Sun Protection: The Beach Adventure', level=2),
146
+ TextEditorBlockData(
147
+ text='Sun exposure is like a wild animal - it can burn you in seconds!'),
148
+ TextEditorBlockData(
149
+ text='Apply sunscreen regularly and wear protective clothing to avoid sunburn and skin damage.'),
150
+ TextEditorBlockData(text=''),
151
+ HeadingEditorBlockData(text='Emergency Pool Procedures', level=2),
152
+ TextEditorBlockData(
153
+ text='If you encounter a pool emergency, stay calm and follow established protocols.'),
154
+ TextEditorBlockData(
155
+ text='Having lifeguards on duty is like having a superhero sidekick - it\'s always good to have backup!'),
113
156
  ]
114
157
 
115
158
  CONSTRUCTION_SAFETY_BLOCKS = [
116
- TextBlock(value=''),
117
- HeadingBlock(value='Construction Safety: A Building Adventure'),
118
- TextBlock(value=''),
119
- SubHeadingBlock(value='The Construction Zone'),
120
- TextBlock(value='Step into the exciting world of construction safety! Every builder should know how to protect themselves from falling objects, electrical hazards, and unexpected structural issues.'),
121
- TextBlock(value='Whether you\'re working on a skyscraper or a small home renovation, these safety tips will keep you safe while you build your dreams.'),
122
- TextBlock(value=''),
123
- SubHeadingBlock(value='Falling Object Safety: The Sky is Falling'),
124
- TextBlock(value='Construction sites are like a battlefield - falling objects can strike at any moment!'),
125
- TextBlock(value='Always wear proper head protection and stay clear of work zones.'),
126
- TextBlock(value=''),
127
- SubHeadingBlock(value='Electrical Safety: The Power Adventure'),
128
- TextBlock(value='Electricity is like a wild animal - it can shock you in seconds!'),
129
- TextBlock(value='Always check electrical equipment before use and never work on live circuits.'),
130
- TextBlock(value=''),
131
- SubHeadingBlock(value='Emergency Construction Procedures'),
132
- TextBlock(value='If you encounter a construction emergency, stay calm and follow established protocols.'),
133
- TextBlock(value='Having safety officers on site is like having a superhero sidekick - it\'s always good to have backup!'),
159
+ TextEditorBlockData(text=''),
160
+ HeadingEditorBlockData(text='Construction Safety: A Building Adventure', level=1),
161
+ TextEditorBlockData(text=''),
162
+ HeadingEditorBlockData(text='The Construction Zone', level=2),
163
+ TextEditorBlockData(
164
+ text='Step into the exciting world of construction safety! Every builder should know how to protect themselves from falling objects, electrical hazards, and unexpected structural issues.'),
165
+ TextEditorBlockData(
166
+ text='Whether you\'re working on a skyscraper or a small home renovation, these safety tips will keep you safe while you build your dreams.'),
167
+ TextEditorBlockData(text=''),
168
+ HeadingEditorBlockData(text='Falling Object Safety: The Sky is Falling', level=2),
169
+ TextEditorBlockData(
170
+ text='Construction sites are like a battlefield - falling objects can strike at any moment!'),
171
+ TextEditorBlockData(
172
+ text='Always wear proper head protection and stay clear of work zones.'),
173
+ TextEditorBlockData(text=''),
174
+ HeadingEditorBlockData(text='Electrical Safety: The Power Adventure', level=2),
175
+ TextEditorBlockData(
176
+ text='Electricity is like a wild animal - it can shock you in seconds!'),
177
+ TextEditorBlockData(
178
+ text='Always check electrical equipment before use and never work on live circuits.'),
179
+ TextEditorBlockData(text=''),
180
+ HeadingEditorBlockData(text='Emergency Construction Procedures', level=2),
181
+ TextEditorBlockData(
182
+ text='If you encounter a construction emergency, stay calm and follow established protocols.'),
183
+ TextEditorBlockData(
184
+ text='Having safety officers on site is like having a superhero sidekick - it\'s always good to have backup!'),
134
185
  ]
135
186
 
136
187
  CYCLING_SAFETY_BLOCKS = [
137
- TextBlock(value=''),
138
- HeadingBlock(value='Bicycle Safety: A Cycling Adventure'),
139
- TextBlock(value=''),
140
- SubHeadingBlock(value='The Road Ahead'),
141
- TextBlock(value='Ride into the exciting world of bicycle safety! Every cyclist should know how to protect themselves from traffic, weather hazards, and mechanical failures.'),
142
- TextBlock(value='Whether you\'re commuting or going for a weekend ride, these tips will keep you safe while you enjoy the open road.'),
143
- TextBlock(value=''),
144
- SubHeadingBlock(value='Traffic Safety: The Highway Adventure'),
145
- TextBlock(value='Riding in traffic is like navigating a busy city - always stay alert and follow traffic rules!'),
146
- TextBlock(value='Always wear a helmet and make sure your bike is properly equipped with lights and reflectors.'),
147
- TextBlock(value=''),
148
- SubHeadingBlock(value='Weather Safety: The Elements Adventure'),
149
- TextBlock(value='Weather conditions can change quickly - always check the forecast before heading out!'),
150
- TextBlock(value='Avoid riding in rain or snow without proper gear and equipment.'),
151
- TextBlock(value=''),
152
- SubHeadingBlock(value='Emergency Bicycle Procedures'),
153
- TextBlock(value='If you encounter a bicycle emergency, stay calm and follow established protocols.'),
154
- TextBlock(value='Having a repair kit on hand is like having a superhero sidekick - it\'s always good to have backup!'),
188
+ TextEditorBlockData(text=''),
189
+ HeadingEditorBlockData(text='Bicycle Safety: A Cycling Adventure', level=1),
190
+ TextEditorBlockData(text=''),
191
+ HeadingEditorBlockData(text='The Road Ahead', level=2),
192
+ TextEditorBlockData(
193
+ text='Ride into the exciting world of bicycle safety! Every cyclist should know how to protect themselves from traffic, weather hazards, and mechanical failures.'),
194
+ TextEditorBlockData(
195
+ text='Whether you\'re commuting or going for a weekend ride, these tips will keep you safe while you enjoy the open road.'),
196
+ TextEditorBlockData(text=''),
197
+ HeadingEditorBlockData(text='Traffic Safety: The Highway Adventure', level=2),
198
+ TextEditorBlockData(
199
+ text='Riding in traffic is like navigating a busy city - always stay alert and follow traffic rules!'),
200
+ TextEditorBlockData(
201
+ text='Always wear a helmet and make sure your bike is properly equipped with lights and reflectors.'),
202
+ TextEditorBlockData(text=''),
203
+ HeadingEditorBlockData(text='Weather Safety: The Elements Adventure', level=2),
204
+ TextEditorBlockData(
205
+ text='Weather conditions can change quickly - always check the forecast before heading out!'),
206
+ TextEditorBlockData(
207
+ text='Avoid riding in rain or snow without proper gear and equipment.'),
208
+ TextEditorBlockData(text=''),
209
+ HeadingEditorBlockData(text='Emergency Bicycle Procedures', level=2),
210
+ TextEditorBlockData(
211
+ text='If you encounter a bicycle emergency, stay calm and follow established protocols.'),
212
+ TextEditorBlockData(
213
+ text='Having a repair kit on hand is like having a superhero sidekick - it\'s always good to have backup!'),
155
214
  ]
156
215
 
157
216
  FIRE_SAFETY_BLOCKS = [
158
- TextBlock(value=''),
159
- HeadingBlock(value='Fire Safety: A Blaze Adventure'),
160
- TextBlock(value=''),
161
- SubHeadingBlock(value='The Fire Escape'),
162
- TextBlock(value='Enter the exciting world of fire safety! Every person should know how to protect themselves from flames, smoke, and unexpected fires.'),
163
- TextBlock(value='Whether you\'re at home or in a public building, these tips will keep you safe while you navigate fire hazards.'),
164
- TextBlock(value=''),
165
- SubHeadingBlock(value='Fire Prevention: The Prevention Adventure'),
166
- TextBlock(value='Prevention is better than cure - always keep fire extinguishers accessible and never leave candles unattended!'),
167
- TextBlock(value='Keep flammable materials away from heat sources and maintain proper ventilation.'),
168
- TextBlock(value=''),
169
- SubHeadingBlock(value='Evacuation Safety: The Escape Route'),
170
- TextBlock(value='Knowing your escape routes is like having a superhero power - it\'s invaluable when you need it most!'),
171
- TextBlock(value='Always practice evacuation drills and keep emergency contact information handy.'),
172
- TextBlock(value=''),
173
- SubHeadingBlock(value='Emergency Fire Procedures'),
174
- TextBlock(value='If you encounter a fire emergency, stay calm and follow established protocols.'),
175
- TextBlock(value='Having fire safety training is like having a superhero sidekick - it\'s always good to have backup!'),
217
+ TextEditorBlockData(text=''),
218
+ HeadingEditorBlockData(text='Fire Safety: A Blaze Adventure', level=1),
219
+ TextEditorBlockData(text=''),
220
+ HeadingEditorBlockData(text='The Fire Escape', level=2),
221
+ TextEditorBlockData(
222
+ text='Enter the exciting world of fire safety! Every person should know how to protect themselves from flames, smoke, and unexpected fires.'),
223
+ TextEditorBlockData(
224
+ text='Whether you\'re at home or in a public building, these tips will keep you safe while you navigate fire hazards.'),
225
+ TextEditorBlockData(text=''),
226
+ HeadingEditorBlockData(text='Fire Prevention: The Prevention Adventure', level=2),
227
+ TextEditorBlockData(
228
+ text='Prevention is better than cure - always keep fire extinguishers accessible and never leave candles unattended!'),
229
+ TextEditorBlockData(
230
+ text='Keep flammable materials away from heat sources and maintain proper ventilation.'),
231
+ TextEditorBlockData(text=''),
232
+ HeadingEditorBlockData(text='Evacuation Safety: The Escape Route', level=2),
233
+ TextEditorBlockData(
234
+ text='Knowing your escape routes is like having a superhero power - it\'s invaluable when you need it most!'),
235
+ TextEditorBlockData(
236
+ text='Always practice evacuation drills and keep emergency contact information handy.'),
237
+ TextEditorBlockData(text=''),
238
+ HeadingEditorBlockData(text='Emergency Fire Procedures', level=2),
239
+ TextEditorBlockData(
240
+ text='If you encounter a fire emergency, stay calm and follow established protocols.'),
241
+ TextEditorBlockData(
242
+ text='Having fire safety training is like having a superhero sidekick - it\'s always good to have backup!'),
176
243
  ]
177
244
 
178
245
  HIKING_SAFETY_BLOCKS = [
179
- TextBlock(value=''),
180
- HeadingBlock(value='Hiking Safety: A Mountain Adventure'),
181
- TextBlock(value=''),
182
- SubHeadingBlock(value='The Trail Ahead'),
183
- TextBlock(value='Embark on the exciting world of hiking safety! Every hiker should know how to protect themselves from weather hazards, wildlife encounters, and unexpected terrain.'),
184
- TextBlock(value='Whether you\'re taking a short walk or a multi-day trek, these tips will keep you safe while you explore nature.'),
185
- TextBlock(value=''),
186
- SubHeadingBlock(value='Weather Safety: The Elements Adventure'),
187
- TextBlock(value='Weather conditions can change quickly in the wilderness - always check forecasts before heading out!'),
188
- TextBlock(value='Pack appropriate gear for all weather conditions and never hike alone in dangerous areas.'),
189
- TextBlock(value=''),
190
- SubHeadingBlock(value='Wildlife Safety: The Animal Encounter'),
191
- TextBlock(value='Wild animals are like wild cards - they can appear at any moment and behave unpredictably!'),
192
- TextBlock(value='Keep food stored properly and maintain a safe distance from wildlife.'),
193
- TextBlock(value=''),
194
- SubHeadingBlock(value='Emergency Hiking Procedures'),
195
- TextBlock(value='If you encounter a hiking emergency, stay calm and follow established protocols.'),
196
- TextBlock(value='Having a first aid kit and emergency communication device is like having a superhero sidekick - it\'s always good to have backup!'),
246
+ TextEditorBlockData(text=''),
247
+ HeadingEditorBlockData(text='Hiking Safety: A Mountain Adventure', level=1),
248
+ TextEditorBlockData(text=''),
249
+ HeadingEditorBlockData(text='The Trail Ahead', level=2),
250
+ TextEditorBlockData(
251
+ text='Embark on the exciting world of hiking safety! Every hiker should know how to protect themselves from weather hazards, wildlife encounters, and unexpected terrain.'),
252
+ TextEditorBlockData(
253
+ text='Whether you\'re taking a short walk or a multi-day trek, these tips will keep you safe while you explore nature.'),
254
+ TextEditorBlockData(text=''),
255
+ HeadingEditorBlockData(text='Weather Safety: The Elements Adventure', level=2),
256
+ TextEditorBlockData(
257
+ text='Weather conditions can change quickly in the wilderness - always check forecasts before heading out!'),
258
+ TextEditorBlockData(
259
+ text='Pack appropriate gear for all weather conditions and never hike alone in dangerous areas.'),
260
+ TextEditorBlockData(text=''),
261
+ HeadingEditorBlockData(text='Wildlife Safety: The Animal Encounter', level=2),
262
+ TextEditorBlockData(
263
+ text='Wild animals are like wild cards - they can appear at any moment and behave unpredictably!'),
264
+ TextEditorBlockData(
265
+ text='Keep food stored properly and maintain a safe distance from wildlife.'),
266
+ TextEditorBlockData(text=''),
267
+ HeadingEditorBlockData(text='Emergency Hiking Procedures', level=2),
268
+ TextEditorBlockData(
269
+ text='If you encounter a hiking emergency, stay calm and follow established protocols.'),
270
+ TextEditorBlockData(
271
+ text='Having a first aid kit and emergency communication device is like having a superhero sidekick - it\'s always good to have backup!'),
197
272
  ]
198
273
 
199
274
  BOATING_SAFETY_BLOCKS = [
200
- TextBlock(value=''),
201
- HeadingBlock(value='Boating Safety: A Water Adventure'),
202
- TextBlock(value=''),
203
- SubHeadingBlock(value='The Ocean Escape'),
204
- TextBlock(value='Set sail into the exciting world of boating safety! Every sailor should know how to protect themselves from water hazards, weather conditions, and unexpected emergencies.'),
205
- TextBlock(value='Whether you\'re on a small boat or a large vessel, these tips will keep you safe while you enjoy the water.'),
206
- TextBlock(value=''),
207
- SubHeadingBlock(value='Water Safety: The Ocean Adventure'),
208
- TextBlock(value='Boating on water is like navigating a wild ocean - always stay alert and follow safety protocols!'),
209
- TextBlock(value='Always wear life jackets and check weather conditions before heading out.'),
210
- TextBlock(value=''),
211
- SubHeadingBlock(value='Navigation Safety: The Compass Adventure'),
212
- TextBlock(value='Proper navigation is like having a superhero power - it\'s invaluable when you need it most!'),
213
- TextBlock(value='Use proper navigation equipment and never navigate without a backup plan.'),
214
- TextBlock(value=''),
215
- SubHeadingBlock(value='Emergency Boating Procedures'),
216
- TextBlock(value='If you encounter a boating emergency, stay calm and follow established protocols.'),
217
- TextBlock(value='Having safety equipment on board is like having a superhero sidekick - it\'s always good to have backup!'),
275
+ TextEditorBlockData(text=''),
276
+ HeadingEditorBlockData(text='Boating Safety: A Water Adventure', level=1),
277
+ TextEditorBlockData(text=''),
278
+ HeadingEditorBlockData(text='The Ocean Escape', level=2),
279
+ TextEditorBlockData(
280
+ text='Set sail into the exciting world of boating safety! Every sailor should know how to protect themselves from water hazards, weather conditions, and unexpected emergencies.'),
281
+ TextEditorBlockData(
282
+ text='Whether you\'re on a small boat or a large vessel, these tips will keep you safe while you enjoy the water.'),
283
+ TextEditorBlockData(text=''),
284
+ HeadingEditorBlockData(text='Water Safety: The Ocean Adventure', level=2),
285
+ TextEditorBlockData(
286
+ text='Boating on water is like navigating a wild ocean - always stay alert and follow safety protocols!'),
287
+ TextEditorBlockData(
288
+ text='Always wear life jackets and check weather conditions before heading out.'),
289
+ TextEditorBlockData(text=''),
290
+ HeadingEditorBlockData(text='Navigation Safety: The Compass Adventure', level=2),
291
+ TextEditorBlockData(
292
+ text='Proper navigation is like having a superhero power - it\'s invaluable when you need it most!'),
293
+ TextEditorBlockData(
294
+ text='Use proper navigation equipment and never navigate without a backup plan.'),
295
+ TextEditorBlockData(text=''),
296
+ HeadingEditorBlockData(text='Emergency Boating Procedures', level=2),
297
+ TextEditorBlockData(
298
+ text='If you encounter a boating emergency, stay calm and follow established protocols.'),
299
+ TextEditorBlockData(
300
+ text='Having safety equipment on board is like having a superhero sidekick - it\'s always good to have backup!'),
218
301
  ]
219
302
 
220
303
 
@@ -4,7 +4,7 @@ from django_spire.contrib.service import BaseDjangoModelService
4
4
 
5
5
  from typing import TYPE_CHECKING
6
6
 
7
- from django_spire.knowledge.entry.version.block.maps import ENTRY_BLOCK_MAP
7
+ from django_spire.knowledge.entry.version.block.data.maps import EDITOR_BLOCK_DATA_MAP
8
8
  from django_spire.knowledge.entry.version.maps import FILE_TYPE_CONVERTER_MAP
9
9
 
10
10
  if TYPE_CHECKING:
@@ -17,36 +17,6 @@ if TYPE_CHECKING:
17
17
  class EntryVersionBlockFactoryService(BaseDjangoModelService['EntryVersionBlock']):
18
18
  obj: EntryVersionBlock
19
19
 
20
- def create_blank_block(
21
- self,
22
- entry_version: EntryVersion,
23
- block_type: BlockTypeChoices,
24
- order: int,
25
- **kwargs
26
- ) -> EntryVersionBlock:
27
- self.obj = self.obj_class(
28
- version=entry_version,
29
- type=block_type,
30
- order=order,
31
- )
32
- self.obj.block = ENTRY_BLOCK_MAP[block_type](
33
- value='',
34
- type=block_type,
35
- **kwargs
36
- )
37
- self.obj.save()
38
-
39
- self.obj.ordering_services.processor.move_to_position(
40
- destination_objects=(
41
- self.obj_class.objects
42
- .active()
43
- .by_version_id(entry_version_id=entry_version.id)
44
- ),
45
- position=order,
46
- )
47
-
48
- return self.obj
49
-
50
20
  def create_blocks_from_file(
51
21
  self,
52
22
  file: File,
@@ -61,23 +31,20 @@ class EntryVersionBlockFactoryService(BaseDjangoModelService['EntryVersionBlock'
61
31
  converter.convert_file_to_blocks(file=file)
62
32
  )
63
33
 
64
- def create_null_block(
34
+ def create_validated_block(
65
35
  self,
66
36
  entry_version: EntryVersion,
67
37
  block_type: BlockTypeChoices,
68
- order: int,
69
- value: str,
70
- **kwargs,
38
+ block_data: dict,
39
+ block_order: int,
40
+ block_tunes: dict = {}
71
41
  ):
72
- self.obj = self.obj_class(
73
- version=entry_version,
74
- type=block_type,
75
- order=order
76
- )
77
- block = ENTRY_BLOCK_MAP[block_type](
78
- type=block_type,
79
- value=value,
80
- **kwargs
81
- )
82
- self.obj.block = block
83
- return self.obj
42
+ self.obj.version = entry_version
43
+ self.obj.type = block_type
44
+ self.obj.order = block_order
45
+ self.obj.tunes = block_tunes
46
+ self.obj.editor_block_data = EDITOR_BLOCK_DATA_MAP[block_type](**block_data)
47
+
48
+ self.obj.clean()
49
+
50
+ return self.obj