def paginate_notifications(paginate, notifications, records_per_page, page_no): """ """ count = len(notifications) if paginate: notifications = paginate_objects(notifications, records_per_page, page_no) return {'notifications': notifications, 'count': count, 'returned_count': len(notifications)}
def paginate_standards(paginate, standards, records_per_page, page_no): """ """ count = len(standards) if paginate: standards = paginate_objects(standards, records_per_page, page_no) return {'standards': standards, 'count': count, 'returned_count': len(standards)}
def paginate_subjects(paginate, subjects, records_per_page, page_no): """ """ count = len(subjects) if paginate: subjects = paginate_objects(subjects, records_per_page, page_no) return {'subjects': subjects, 'count': count, 'returned_count': len(subjects)}
def get_staff(page_no=1, paginate=True, records_per_page=10): """ Returns list of non teaching staff Params: page_no: page_no paginate: If False return all objects, else return objects on given page """ staff = Staff.objects.filter(user__is_active=True).exclude( staff_type__code='TC') if paginate: staff = paginate_objects(staff, records_per_page, page_no=page_no) return staff
def get_academic_years(records_per_page=10, page_no=1, paginate=True): """ """ academic_years = AcademicYear.objects.exclude(status='D') count = len(academic_years) if paginate: academic_years = paginate_objects(academic_years, records_per_page, page_no) return { 'years': academic_years, 'count': count, 'returned_count': len(academic_years) }
def get_teachers(page_no=1, paginate=True, records_per_page=10): """ Returns list of teachers Params: page_no: page_no paginate: If False return all objects, else return objects on given page """ teachers = Teacher.objects.filter(staff__user__is_active=True) if paginate: teachers = paginate_objects(teachers, records_per_page, page_no=page_no) return teachers
def get_std_templates(return_all=False, page_no=1, paginate=True, records_per_page=10): """ Returns notices to edit Params: creator: User object return_all: weather to apply creator filter or not page_no: page_no paginate: If False return all objects, else return objects on given page """ templates = StandardTemplate.objects.exclude(status='D') count = len(templates) if paginate: templates = paginate_objects(templates, records_per_page, page_no) return { 'std_templates': templates, 'count': count, 'returned_count': len(templates) }