diff --git a/server/config/urls.py b/server/config/urls.py index 5cd607f0..ddc6cd80 100644 --- a/server/config/urls.py +++ b/server/config/urls.py @@ -28,12 +28,12 @@ from vbv_lernwelt.course.views import ( request_course_completion, request_course_completion_for_user, ) + +from vbv_lernwelt.feedback.views import get_name from wagtail import urls as wagtail_urls from wagtail.admin import urls as wagtailadmin_urls from wagtail.documents import urls as wagtaildocs_urls -from vbv_lernwelt.feedback.views import get_name - def raise_example_error(request): """ diff --git a/server/vbv_lernwelt/feedback/graphql/mutations.py b/server/vbv_lernwelt/feedback/graphql/mutations.py index daf2713b..0d0c109f 100644 --- a/server/vbv_lernwelt/feedback/graphql/mutations.py +++ b/server/vbv_lernwelt/feedback/graphql/mutations.py @@ -1,5 +1,5 @@ -from graphene_django.rest_framework.mutation import SerializerMutation import graphene +from graphene_django.rest_framework.mutation import SerializerMutation from vbv_lernwelt.feedback.serializers import FeedbackResponseSerializer diff --git a/server/vbv_lernwelt/feedback/migrations/0001_initial.py b/server/vbv_lernwelt/feedback/migrations/0001_initial.py index d4fb10a8..6a98c1a5 100644 --- a/server/vbv_lernwelt/feedback/migrations/0001_initial.py +++ b/server/vbv_lernwelt/feedback/migrations/0001_initial.py @@ -1,8 +1,9 @@ # Generated by Django 3.2.13 on 2022-12-08 15:59 import django.core.validators -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models + import vbv_lernwelt.feedback.models @@ -11,26 +12,95 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('learnpath', '0009_alter_learningcontent_contents'), + ("learnpath", "0009_alter_learningcontent_contents"), ] operations = [ migrations.CreateModel( - name='FeedbackResponse', + name="FeedbackResponse", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('satisfaction', vbv_lernwelt.feedback.models.FeedbackIntegerField(null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4), django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4)])), - ('goal_attainment', vbv_lernwelt.feedback.models.FeedbackIntegerField(null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4), django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4)])), - ('proficiency', models.IntegerField(null=True)), - ('received_materials', models.BooleanField(null=True)), - ('materials_rating', vbv_lernwelt.feedback.models.FeedbackIntegerField(null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4), django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4)])), - ('instructor_competence', vbv_lernwelt.feedback.models.FeedbackIntegerField(null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4), django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4)])), - ('instructor_respect', vbv_lernwelt.feedback.models.FeedbackIntegerField(null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4), django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(4)])), - ('instructor_open_feedback', models.TextField(blank=True)), - ('would_recommend', models.BooleanField(null=True)), - ('course_positive_feedback', models.TextField(blank=True)), - ('course_negative_feedback', models.TextField(blank=True)), - ('circle', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='learnpath.circle')), + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "satisfaction", + vbv_lernwelt.feedback.models.FeedbackIntegerField( + null=True, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4), + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4), + ], + ), + ), + ( + "goal_attainment", + vbv_lernwelt.feedback.models.FeedbackIntegerField( + null=True, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4), + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4), + ], + ), + ), + ("proficiency", models.IntegerField(null=True)), + ("received_materials", models.BooleanField(null=True)), + ( + "materials_rating", + vbv_lernwelt.feedback.models.FeedbackIntegerField( + null=True, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4), + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4), + ], + ), + ), + ( + "instructor_competence", + vbv_lernwelt.feedback.models.FeedbackIntegerField( + null=True, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4), + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4), + ], + ), + ), + ( + "instructor_respect", + vbv_lernwelt.feedback.models.FeedbackIntegerField( + null=True, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4), + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(4), + ], + ), + ), + ("instructor_open_feedback", models.TextField(blank=True)), + ("would_recommend", models.BooleanField(null=True)), + ("course_positive_feedback", models.TextField(blank=True)), + ("course_negative_feedback", models.TextField(blank=True)), + ( + "circle", + models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="learnpath.circle", + ), + ), ], ), ] diff --git a/server/vbv_lernwelt/feedback/wagtail_hooks.py b/server/vbv_lernwelt/feedback/wagtail_hooks.py index 30d9b57b..17c2f891 100644 --- a/server/vbv_lernwelt/feedback/wagtail_hooks.py +++ b/server/vbv_lernwelt/feedback/wagtail_hooks.py @@ -1,4 +1,5 @@ from wagtail.core import hooks + from .graphql.mutations import Mutation diff --git a/server/vbv_lernwelt/learnpath/migrations/0009_alter_learningcontent_contents.py b/server/vbv_lernwelt/learnpath/migrations/0009_alter_learningcontent_contents.py index 8e15731d..b5b5211f 100644 --- a/server/vbv_lernwelt/learnpath/migrations/0009_alter_learningcontent_contents.py +++ b/server/vbv_lernwelt/learnpath/migrations/0009_alter_learningcontent_contents.py @@ -1,20 +1,126 @@ # Generated by Django 3.2.13 on 2022-12-08 09:55 -from django.db import migrations import wagtail.blocks import wagtail.fields +from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ('learnpath', '0008_alter_learningcontent_contents'), + ("learnpath", "0008_alter_learningcontent_contents"), ] operations = [ migrations.AlterField( - model_name='learningcontent', - name='contents', - field=wagtail.fields.StreamField([('video', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('resource', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock()), ('text', wagtail.blocks.RichTextBlock(required=False))])), ('exercise', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('learningmodule', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('online_training', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('media_library', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('document', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('test', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('book', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('assignment', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock()), ('text', wagtail.blocks.RichTextBlock(required=False))])), ('placeholder', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('feedback', wagtail.blocks.StructBlock([]))], use_json_field=None), + model_name="learningcontent", + name="contents", + field=wagtail.fields.StreamField( + [ + ( + "video", + wagtail.blocks.StructBlock( + [ + ("description", wagtail.blocks.TextBlock()), + ("url", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "resource", + wagtail.blocks.StructBlock( + [ + ("description", wagtail.blocks.TextBlock()), + ("url", wagtail.blocks.TextBlock()), + ("text", wagtail.blocks.RichTextBlock(required=False)), + ] + ), + ), + ( + "exercise", + wagtail.blocks.StructBlock( + [ + ("description", wagtail.blocks.TextBlock()), + ("url", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "learningmodule", + wagtail.blocks.StructBlock( + [ + ("description", wagtail.blocks.TextBlock()), + ("url", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "online_training", + wagtail.blocks.StructBlock( + [ + ("description", wagtail.blocks.TextBlock()), + ("url", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "media_library", + wagtail.blocks.StructBlock( + [ + ("description", wagtail.blocks.TextBlock()), + ("url", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "document", + wagtail.blocks.StructBlock( + [ + ("description", wagtail.blocks.TextBlock()), + ("url", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "test", + wagtail.blocks.StructBlock( + [ + ("description", wagtail.blocks.TextBlock()), + ("url", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "book", + wagtail.blocks.StructBlock( + [ + ("description", wagtail.blocks.TextBlock()), + ("url", wagtail.blocks.TextBlock()), + ] + ), + ), + ( + "assignment", + wagtail.blocks.StructBlock( + [ + ("description", wagtail.blocks.TextBlock()), + ("url", wagtail.blocks.TextBlock()), + ("text", wagtail.blocks.RichTextBlock(required=False)), + ] + ), + ), + ( + "placeholder", + wagtail.blocks.StructBlock( + [ + ("description", wagtail.blocks.TextBlock()), + ("url", wagtail.blocks.TextBlock()), + ] + ), + ), + ("feedback", wagtail.blocks.StructBlock([])), + ], + use_json_field=None, + ), ), ] diff --git a/server/vbv_lernwelt/learnpath/models.py b/server/vbv_lernwelt/learnpath/models.py index 6d85877c..33e8fd2a 100644 --- a/server/vbv_lernwelt/learnpath/models.py +++ b/server/vbv_lernwelt/learnpath/models.py @@ -14,7 +14,8 @@ from vbv_lernwelt.learnpath.models_learning_unit_content import ( BookBlock, DocumentBlock, ExerciseBlock, - FeedbackBlock, LearningModuleBlock, + FeedbackBlock, + LearningModuleBlock, MediaLibraryBlock, OnlineTrainingBlock, PlaceholderBlock,