예제 #1
0
파일: han-list.py 프로젝트: Jille/kninfra
def main():
    leden = frozenset(Es.by_name('leden').get_members())
    han = Es.by_id('4e6fcc85e60edf3dc0000015')
    for m in sorted(Es.by_institute(han), key=lambda x: str(x.name)):
        if not m in leden:
            continue
        ok = False
        for study in m.studies:
            if study['institute'] != han:
                continue
            if study['until'] is None or study['until'] >= Es.now():
                ok = True
        print "%-30s %-10s %s" % (m.full_name, study['number'],
                                  unicode(study['study'].humanName))
예제 #2
0
파일: han-list.py 프로젝트: Jille/kninfra
def main():
    leden = frozenset(Es.by_name('leden').get_members())
    han = Es.by_id('4e6fcc85e60edf3dc0000015')
    for m in sorted(Es.by_institute(han), key=lambda x: str(x.name)):
        if not m in leden:
            continue
        ok = False
        for study in m.studies:
            if study['institute'] != han:
                continue
            if study['until'] is None or study['until'] >= Es.now():
                ok = True
        print "%-30s %-10s %s" % (m.full_name, study['number'],
                        unicode(study['study'].humanName))
예제 #3
0
def _institute_detail(request, institute):
    ctx = _entity_detail(request, institute)
    ctx['students'] = students = []

    for student in Es.by_institute(institute):
        for _study in student.studies:
            if _study['institute'] != institute:
                continue
            students.append({'student': student,
                             'from': _study['from'],
                             'until': _study['until'],
                             'study': _study['study']})
    ctx['students'].sort(key=lambda s: (Es.dt_until(s['until']),
                                        s['student'].humanName))
    return render(request, 'leden/institute_detail.html', ctx)
예제 #4
0
파일: views.py 프로젝트: Blackeel/kninfra
def _institute_detail(request, institute):
    ctx = _entity_detail(request, institute)
    ctx['students'] = students = []

    for student in Es.by_institute(institute):
        for _study in student.studies:
            if _study['institute'] != institute:
                continue
            students.append({
                'student': student,
                'from': _study['from'],
                'until': _study['until'],
                'study': _study['study']
            })
    ctx['students'].sort(
        key=lambda s: (Es.dt_until(s['until']), s['student'].humanName))
    return render(request, 'leden/institute_detail.html', ctx)
예제 #5
0
파일: views.py 프로젝트: Soyweiser/kninfra
def _institute_detail(request, institute):
    ctx = _entity_detail(request, institute)
    ctx['students'] = students = []
    def _cmp(s1, s2):
        r = Es.dt_cmp_until(s2['until'], s1['until'])
        if r: return r
        return cmp(s1['student'].humanName, s2['student'].humanName)
    for student in Es.by_institute(institute):
        for _study in student.studies:
            if _study['institute'] != institute:
                continue
            students.append({'student': student,
                             'from': _study['from'],
                             'until': _study['until'],
                             'study': _study['study']})
    ctx['students'].sort(cmp=_cmp)
    return render_to_response('leden/institute_detail.html', ctx,
            context_instance=RequestContext(request))
예제 #6
0
파일: views.py 프로젝트: Jille/kninfra
def _institute_detail(request, institute):
    ctx = _entity_detail(request, institute)
    ctx['students'] = students = []
    def _cmp(s1, s2):
        r = Es.dt_cmp_until(s2['until'], s1['until'])
        if r: return r
        return cmp(s1['student'].humanName, s2['student'].humanName)
    for student in Es.by_institute(institute):
        for _study in student.studies:
            if _study['institute'] != institute:
                continue
            students.append({'student': student,
                             'from': _study['from'],
                             'until': _study['until'],
                             'study': _study['study']})
    ctx['students'].sort(cmp=_cmp)
    return render_to_response('leden/institute_detail.html', ctx,
            context_instance=RequestContext(request))
예제 #7
0
def _institute_detail(request, institute):
    ctx = _entity_detail(request, institute)
    ctx["students"] = students = []

    def _cmp(s1, s2):
        r = Es.dt_cmp_until(s2["until"], s1["until"])
        if r:
            return r
        return cmp(s1["student"].humanName, s2["student"].humanName)

    for student in Es.by_institute(institute):
        for _study in student.studies:
            if _study["institute"] != institute:
                continue
            students.append(
                {"student": student, "from": _study["from"], "until": _study["until"], "study": _study["study"]}
            )
    ctx["students"].sort(cmp=_cmp)
    return render_to_response("leden/institute_detail.html", ctx, context_instance=RequestContext(request))