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))
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)
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)
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))
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))