added api stuff to readme
This commit is contained in:
parent
56a14d2942
commit
5af863fb6c
|
|
@ -48,3 +48,25 @@ npm run dev
|
||||||
* In the .idea/vbv_lernwelt.iml file change the module type to "PYTHON_MODULE".
|
* In the .idea/vbv_lernwelt.iml file change the module type to "PYTHON_MODULE".
|
||||||
* Add django facet in "Project Structure".
|
* Add django facet in "Project Structure".
|
||||||
* Run configuration with "Python -> server.py" to have async debugging support.
|
* Run configuration with "Python -> server.py" to have async debugging support.
|
||||||
|
|
||||||
|
|
||||||
|
## Wagtail API intro
|
||||||
|
|
||||||
|
get all pages:
|
||||||
|
|
||||||
|
http://localhost:8000/api/v2/pages/
|
||||||
|
|
||||||
|
get Analyse Circle (the one with the most demo data)
|
||||||
|
|
||||||
|
http://localhost:8000/api/v2/pages/?title=Analyse
|
||||||
|
|
||||||
|
|
||||||
|
Get Circles only
|
||||||
|
|
||||||
|
http://localhost:8000/api/v2/pages/?type=learnpath.Circle
|
||||||
|
|
||||||
|
Get All Contents from that circle:
|
||||||
|
|
||||||
|
http://localhost:8000/api/v2/pages/?child_of=11
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from wagtail.core import blocks
|
from wagtail.core import blocks
|
||||||
|
from wagtail.api import APIField
|
||||||
|
|
||||||
|
|
||||||
# 'video_block'
|
# 'video_block'
|
||||||
|
|
@ -12,26 +13,35 @@ class VideoBlock(blocks.StructBlock):
|
||||||
class Meta:
|
class Meta:
|
||||||
icon = 'media'
|
icon = 'media'
|
||||||
|
|
||||||
|
def get_api_representation(self, value, context=None):
|
||||||
|
return {'sdfsdf': 1,
|
||||||
|
'sldkfm': 3}
|
||||||
|
|
||||||
|
RISE = 'rise'
|
||||||
|
|
||||||
|
CONTENT_TYPE_CHOICES = (
|
||||||
|
(RISE, 'Rise'),
|
||||||
|
)
|
||||||
|
|
||||||
# 'Web based training Block'
|
# 'Web based training Block'
|
||||||
class WebBasedTrainingBlock(blocks.StructBlock):
|
class WebBasedTrainingBlock(blocks.StructBlock):
|
||||||
RISE = 'rise'
|
|
||||||
|
|
||||||
WBT_TYPE_CHOICES = (
|
|
||||||
(RISE, 'Rise'),
|
|
||||||
)
|
|
||||||
|
|
||||||
url = blocks.URLBlock()
|
url = blocks.URLBlock()
|
||||||
type = models.CharField(
|
content_type = models.CharField(
|
||||||
max_length=100,
|
max_length=100,
|
||||||
choices=WBT_TYPE_CHOICES,
|
choices=CONTENT_TYPE_CHOICES,
|
||||||
default=RISE
|
default=RISE
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
icon = 'media'
|
icon = 'media'
|
||||||
|
|
||||||
|
def get_api_representation(self, value, context=None):
|
||||||
|
|
||||||
|
return {'sdfsdf': 1,
|
||||||
|
'sldkfm': 3}
|
||||||
|
|
||||||
|
|
||||||
# 'Transver Task'
|
# 'Transver Task'
|
||||||
class TranverTaskBlock(blocks.StructBlock):
|
class TranverTaskBlock(blocks.StructBlock):
|
||||||
title = models.CharField(max_length=128, default="")
|
title = models.CharField(max_length=128, default="")
|
||||||
|
|
|
||||||
|
|
@ -81,13 +81,13 @@ von Neukunden zu benützen
|
||||||
video_url = "https://www.vbv.ch/fileadmin/vbv/Videos/Statements_Externe/Janos_M/Testimonial_Janos_Mischler_PositiveEffekte.mp4"
|
video_url = "https://www.vbv.ch/fileadmin/vbv/Videos/Statements_Externe/Janos_M/Testimonial_Janos_Mischler_PositiveEffekte.mp4"
|
||||||
video_title = "Ausbildung ist pflicht"
|
video_title = "Ausbildung ist pflicht"
|
||||||
video_description = "Erfahren Sie, was für Janos Mischler die positiven Aspekte von ständiger Weiterbildung sind – aus fachlicher und aus persönlicher Sicht."
|
video_description = "Erfahren Sie, was für Janos Mischler die positiven Aspekte von ständiger Weiterbildung sind – aus fachlicher und aus persönlicher Sicht."
|
||||||
video_block = VideoBlockFactory(type="video", url=video_url, title=video_title, description=video_description)
|
video_block = VideoBlockFactory(content_type="video", url=video_url, title=video_title, description=video_description)
|
||||||
learning_unit.contents.append(('video', video_block))
|
learning_unit.contents.append(('video', video_block))
|
||||||
learning_unit.save()
|
learning_unit.save()
|
||||||
|
|
||||||
learning_unit = LearningUnitFactory.create(title='** Web Based Training"', parent=circle_4, learning_package=lpck_1)
|
learning_unit = LearningUnitFactory.create(title='** Web Based Training"', parent=circle_4, learning_package=lpck_1)
|
||||||
wbt_url = "web_based_trainings/rise_cmi5_test_export/scormcontent/index.html"
|
wbt_url = "web_based_trainings/rise_cmi5_test_export/scormcontent/index.html"
|
||||||
wbt_block = WebBasedTrainingBlockFactory(type="web_based_training", url=wbt_url)
|
wbt_block = WebBasedTrainingBlockFactory(content_type="web_based_training", url=wbt_url)
|
||||||
learning_unit.contents.append(('web_based_training', wbt_block))
|
learning_unit.contents.append(('web_based_training', wbt_block))
|
||||||
learning_unit.save()
|
learning_unit.save()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue