Exemple #1
0
def editparticipationstatusebycourse(request, courseid, date):
    data = {}
    courserecords = TrainessCourseRecord.objects.filter(course__pk=int(courseid), approved=True)
    data['courserecords'] = {}
    for courserecord in courserecords:
        data['courserecords'][courserecord] = getparticipationforms_by_date(courserecord, date)
    if request.POST:
        for courserecord in courserecords:
            morning = request.POST.get("participation" + str(courserecord.pk) + str(date) + "-morning")
            afternoon = request.POST.get("participation" + str(courserecord.pk) + str(date) + "-afternoon")
            evening = request.POST.get("participation" + str(courserecord.pk) + str(date) + "-evening")
            tp = TrainessParticipation.objects.filter(courserecord=courserecord, day=str(date)).first()
            if tp:
                tp.morning = morning
                tp.afternoon = afternoon
                tp.evening = evening
                tp.save()
            else:
                trainessp = TrainessParticipation(courserecord=courserecord, day=str(date), morning=morning,
                                                  afternoon=afternoon, evening=evening)
                trainessp.save()
            data['courserecords'][courserecord] = getparticipationforms_by_date(courserecord, date)
    data['note'] = "Yoklama bilgilerini girmek için kullanıcı profiline gidiniz."
    data['date'] = date
    return render(request, 'training/courseparstatus.html', data)
Exemple #2
0
def editparticipationstatusebycourse(request, courseid, date):
    d = {'clientip': request.META['REMOTE_ADDR'], 'user': request.user}
    data = getsiteandmenus(request)
    courserecords = TrainessCourseRecord.objects.filter(
        course__pk=int(courseid), approved=True)
    data['courserecords'] = {}
    for courserecord in courserecords:
        data['courserecords'][courserecord] = getparticipationforms_by_date(
            courserecord, date)
    if request.POST:
        for courserecord in courserecords:
            morning = request.POST.get("participation" + str(courserecord.pk) +
                                       str(date) + "-morning")
            afternoon = request.POST.get("participation" +
                                         str(courserecord.pk) + str(date) +
                                         "-afternoon")
            evening = request.POST.get("participation" + str(courserecord.pk) +
                                       str(date) + "-evening")
            tp = TrainessParticipation.objects.filter(
                courserecord=courserecord, day=str(date)).first()
            if tp:
                tp.morning = morning
                tp.afternoon = afternoon
                tp.evening = evening
                tp.save()
            else:
                trainessp = TrainessParticipation(courserecord=courserecord,
                                                  day=str(date),
                                                  morning=morning,
                                                  afternoon=afternoon,
                                                  evening=evening)
                trainessp.save()
            data['courserecords'][
                courserecord] = getparticipationforms_by_date(
                    courserecord, date)
    data[
        'note'] = "Yoklama bilgilerini girmek için kullanıcı profiline gidiniz."
    data['date'] = date
    return render_to_response('training/courseparstatus.html',
                              data,
                              context_instance=RequestContext(request))
def getparformsbydate(cr, date):
    form = getparticipationforms_by_date(cr, date)
    return form.as_ul()