diff --git a/stages/admin.py b/stages/admin.py index 295e1a3..09f9bc7 100644 --- a/stages/admin.py +++ b/stages/admin.py @@ -15,9 +15,9 @@ class KlassAdmin(admin.ModelAdmin): class StudentAdmin(admin.ModelAdmin): - list_display = ('__unicode__', 'pcode', 'city', 'klass') + list_display = ('__unicode__', 'pcode', 'city', 'klass', 'archived') ordering = ('last_name', 'first_name') - list_filter = ('klass',) + list_filter = ('klass', 'archived') search_fields = ('last_name', 'first_name', 'pcode', 'city', 'klass__name') fields = (('last_name', 'first_name'), 'street', ('pcode', 'city'), 'email', ('tel', 'mobile'), 'birth_date', 'klass', 'archived') diff --git a/stages/views.py b/stages/views.py index 23542ed..aa612d5 100644 --- a/stages/views.py +++ b/stages/views.py @@ -149,12 +149,13 @@ def section_classes(request, pk): def period_students(request, pk): """ - Return all students from period's section and level, + Return all active students from period's section and level, with corresponding Training if existing (JSON) """ period = get_object_or_404(Period, pk=pk) - students = Student.objects.filter(klass__section=period.section, klass__level=period.relative_level - ).order_by('last_name') + students = Student.objects.filter( + archived=False, klass__section=period.section, klass__level=period.relative_level + ).order_by('last_name') trainings = dict((t.student_id, t.id) for t in Training.objects.filter(availability__period=period)) data = [{ 'name': unicode(s),