diff --git a/course/admin.py b/course/admin.py index 3495bd164..9dcfcd641 100644 --- a/course/admin.py +++ b/course/admin.py @@ -54,6 +54,7 @@ class CourseInstanceAdmin(admin.ModelAdmin): 'course', 'instance_name', 'visible_to_students', + 'group_work_allowed', 'starting_time', 'ending_time', instance_url, diff --git a/course/api/full_serializers.py b/course/api/full_serializers.py index e40b4d4e3..e03d6ce77 100644 --- a/course/api/full_serializers.py +++ b/course/api/full_serializers.py @@ -106,6 +106,7 @@ class Meta(CourseBriefSerializer.Meta): 'starting_time', 'ending_time', 'visible_to_students', + 'group_work_allowed', # links 'exercises', 'tree', @@ -148,6 +149,7 @@ class Meta(AplusModelSerializer.Meta): 'starting_time', 'ending_time', 'visible_to_students', + 'group_work_allowed', 'configure_url', 'teachers', ) @@ -205,6 +207,7 @@ def update(self, instance: CourseInstance, validated_data: OrderedDict) -> Cours instance.starting_time = validated_data.get('starting_time', instance.starting_time) instance.ending_time = validated_data.get('ending_time', instance.ending_time) instance.visible_to_students = validated_data.get('visible_to_students', instance.visible_to_students) + instance.group_work_allowed = validated_data.get('group_work_allowed', instance.group_work_allowed) instance.configure_url = validated_data.get('configure_url', instance.configure_url) instance.save() self.set_teachers(instance, self.teachers) diff --git a/course/migrations/0059_courseinstance_group_work_allowed.py b/course/migrations/0059_courseinstance_group_work_allowed.py new file mode 100644 index 000000000..3e8f74ad4 --- /dev/null +++ b/course/migrations/0059_courseinstance_group_work_allowed.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.13 on 2024-05-22 08:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("course", "0058_coursemodule_model_answer_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="courseinstance", + name="group_work_allowed", + field=models.BooleanField( + default=True, verbose_name="LABEL_GROUP_WORK_ALLOWED" + ), + ), + ] diff --git a/course/models.py b/course/models.py index 3be2edb8f..58d8c41d1 100644 --- a/course/models.py +++ b/course/models.py @@ -614,6 +614,10 @@ class CourseInstance(CourseInstanceProto, models.Model): verbose_name=_('LABEL_VISIBLE_TO_STUDENTS'), default=True, ) + group_work_allowed = models.BooleanField( + verbose_name=_('LABEL_GROUP_WORK_ALLOWED'), + default=True, + ) enrollment_audience = models.IntegerField( verbose_name=_('LABEL_ENROLLMENT_AUDIENCE'), choices=ENROLLMENT_AUDIENCE.choices, diff --git a/course/templates/course/_course_menu.html b/course/templates/course/_course_menu.html index 6857390b3..98307d82f 100644 --- a/course/templates/course/_course_menu.html +++ b/course/templates/course/_course_menu.html @@ -91,7 +91,7 @@

{% translate "COURSE" %}

-{% if instance_max_group_size > 1 %} +{% if instance.group_work_allowed %}