for webclass in Webclass.published.filter(period=self.period, iej=student.iej, course__in=student_courses):
# if webclass.course not in student_courses:
# continue
+ if webclass.platform_only and not student.platform_only:
+ continue
slot = webclass.get_slot(user)
if slot and slot.status in ('almost', 'ingoing'):
slots.append(slot)
except IndexError:
pass
if webclass:
- webclass_slot = webclass.get_slot(self.request.user)
+ if webclass.platform_only and not student.platform_only:
+ webclass = None
+ else:
+ webclass_slot = webclass.get_slot(self.request.user)
context['webclass'] = webclass
context['webclass_slot'] = webclass_slot
--- /dev/null
+# Generated by Django 3.2.3 on 2021-06-16 14:58
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('webclass', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='webclass',
+ name='platform_only',
+ field=models.BooleanField(default=False, verbose_name='platform only'),
+ ),
+ ]
'teleforma.Course', related_name='webclass', verbose_name=_('course'), on_delete=models.CASCADE)
iej = models.ManyToManyField(
'teleforma.IEJ', related_name='webclass', verbose_name=_('iej'), blank=True)
+ platform_only = models.BooleanField(_('platform only'), default=False)
bbb_server = models.ForeignKey(
'BBBServer', related_name='webclass', verbose_name='Serveur BBB', on_delete=models.CASCADE)
duration = DurationField('Durée de la conférence', default="00:30:00")
# Student is in the right IEJ ?
if not student.iej in webclass.iej.all():
return HttpResponse('Unauthorized', status=401)
+ if webclass.platform_only and not student.platform_only:
+ return HttpResponse('Unauthorized', status=401)
+
return
def render(self, request, webclass):