コード例 #1
0
 def save(self, **kw):
     u = Grade(totalPoint=kw['totalPoint'],
               point=kw['point'],
               courseId=kw['courseId'],
               courseName=kw['courseName'],
               techerId=kw['techerId'],
               techerNumber=kw['techerNumber'],
               techerName=kw['techerName'],
               stuId=kw['stuId'],
               stuNumber=kw['stuNumber'],
               stuName=kw['stuName'],
               time=self._nowTime())
     u.save()
コード例 #2
0
def grade_assignment(request, course_slug, assignment_slug, student_username):

    #student & assignment
    courses = Course.objects.filter(teacher=request.user)
    assignment = Assignment.objects.get(slug=assignment_slug)
    student = User.objects.get(username=student_username)
    
    grade = Grade()
    student_grade = StudentGrade(student=student, assignment=assignment)

    #GradeForm
    #StudentGradeForm

    #course = Course.objects.get(slug=course_slug)
    #assignment = Assignment(course=course, teacher=course.teacher)
    
    if request.method == 'POST':
        form = GradeForm(request.POST, request.FILES, instance=grade)
        if form.is_valid():
            grade = form.save()
            student_grade.grade = grade
            student_grade.save()
            return HttpResponseRedirect("/teacher/{0}/grade_assignments/{1}/{2}/assignment_graded/".format(course_slug, assignment_slug, student_username))
    else:
        form = GradeForm()


    return render_to_response('teacher/grade_assignment.html',
        {'form': form,
        'courses':courses,},
        context_instance=RequestContext(request))
コード例 #3
0
ファイル: service.py プロジェクト: freshman88/aedu
 def save(self, **kw):
     u = Grade(totalPoint=kw['totalPoint'], point=kw['point'], courseId=kw['courseId'], courseName=kw['courseName'], 
         techerId=kw['techerId'], techerNumber=kw['techerNumber'], techerName=kw['techerName'],
         stuId=kw['stuId'], stuNumber=kw['stuNumber'], stuName=kw['stuName'],
         time=self._nowTime())
     u.save()
コード例 #4
0
durga = User.objects.create_user('durga', '*****@*****.**', 'thomas')
durga.groups.add(teacher_users)
durga.save()

#Copy and paste everything above into a manage.py shell session

course1  = Course(title="course 1", slug="course-1", description="description", teacher=bob)
course1.save()

week_from_today = datetime.timedelta(days=7)
sample_due_date = datetime.date.today() + week_from_today
assignment1 = Assignment(name="assignment 1",
                         slug="assignment-1",
                         description="Assignment 1 description",
                         #due_date=datetime.datetime(2012, 7, 31, 5, 0, tzinfo=<UTC>),
                         due_date=sample_due_date,
                         teacher=bob,
                         course=course1)
assignment1.save()

grade1 = Grade(letter_grade="A",course=course1,assignment=assignment1)
grade1.save()