I\'m trying to build an e-learning platform
I have users (Utilisateur) who can take several courses ,each course h
SOLVED
1- This is how I've managed to do it :
course = Utilisateur.objects.get(user=current_user).course.all()
course_sets = []
for p in course:
modules = Module.objects.filter(course__id=p.pk).order_by('modulecourse__order')
modules_sets = []
for m in modules:
score = UtilisateurModule.objects.get(module=m,utilisateur=current_user)
modules_sets.append((m, score))
course_sets.append((p, modules_sets))
2- I added course = models.ManyToManyField('Course')
to Utilisateur
and then added some manual verification that whenever A course is affected to a user the modules in that course are also affected to the same user in UtilisateurModule