示例#1
0
def drglearning_careers(request, course_slug, **kwargs):
    course = get_object_or_404(Course, slug=course_slug)
    careers = Career.get_objects_for(course)
    if not careers:
        raise Http404(u"Dr. Glearning course not found")
    if not request.user.players.count():
        reversed_url = reverse("drglearning_settings", args=[course_slug])
        return HttpResponseRedirect(reversed_url)
    else:
        #TODO: Manage multiple players
        default_player = request.user.players.filter(default=True)[0]
    import_player_form = ImportPlayerForm()
    is_enrolled = course.students.filter(id=request.user.id).exists()
    is_teacher = is_teacher_test(request.user, course)
    ctx = {
        "course": course,
        "show_material": True,
        "is_enrolled": is_enrolled,
        "is_teacher": is_teacher,
        "careers": careers,
        "players": request.user.players.all(),
        "default_player": default_player,
        "import_player_form": import_player_form,
        "drglearning_host": DRGLEARNING_HOST,
        "drglearning_embed_url": DRGLEARNING_EMBED_URL,
    }
    ctx = RequestContext(request, ctx)
    return render_to_response("drglearning/careers.html", ctx)
示例#2
0
def drglearning_careers(request, course_slug, **kwargs):
    course = get_object_or_404(Course, slug=course_slug)
    careers = Career.get_objects_for(course)
    if not careers:
        raise Http404(u"Dr. Glearning course not found")
    if not request.user.players.count():
        reversed_url = reverse("drglearning_settings", args=[course_slug])
        return HttpResponseRedirect(reversed_url)
    else:
        #TODO: Manage multiple players
        default_player = request.user.players.filter(default=True)[0]
    import_player_form = ImportPlayerForm()
    is_enrolled = course.students.filter(id=request.user.id).exists()
    is_teacher = is_teacher_test(request.user, course)
    ctx = {
        "course": course,
        "show_material": True,
        "is_enrolled": is_enrolled,
        "is_teacher": is_teacher,
        "careers": careers,
        "players": request.user.players.all(),
        "default_player": default_player,
        "import_player_form": import_player_form,
        "drglearning_host": DRGLEARNING_HOST,
        "drglearning_embed_url": DRGLEARNING_EMBED_URL,
    }
    ctx = RequestContext(request, ctx)
    return render_to_response("drglearning/careers.html", ctx)
示例#3
0
def drglearning_careers(obj):
    careers = Career.get_objects_for(obj)
    return careers