How to use the result.models.CarryOverStudent.objects function in result

To help you get started, we’ve selected a few result examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Abdoulrasheed / django-school-management / result / models.py View on Github external
def is_repeating(self):
        count = CarryOverStudent.objects.filter(student__id=self.student.id)
        units = 0
        for i in count:
            units += int(i.course.courseUnit)
        if count.count() >= 6 or units >=16:
            RepeatingStudent.objects.get_or_create(student=self.student, level=self.student.level)
        else:
            try:
                RepeatingStudent.objects.get(student=self.student, level=self.student.level).delete()
            except:
                pass
github Abdoulrasheed / django-school-management / result / views.py View on Github external
def home(request):
    """ 
    Shows our dashboard containing number of students, courses, lecturers, repating students, 
    carry over students and 1st class students in an interactive graph

    """
    students = Student.objects.all().count()
    staff = User.objects.filter(is_lecturer=True).count()
    courses = Course.objects.all().count()
    current_semester = Semester.objects.get(is_current_semester=True)
    no_of_1st_class_students = Result.objects.filter(cgpa__gte=4.5).count()
    no_of_carry_over_students = CarryOverStudent.objects.all().count()
    no_of_students_to_repeat = RepeatingStudent.objects.all().count()

    context = {
        "no_of_students": students,
        "no_of_staff":staff,
        "no_of_courses": courses,
        "no_of_1st_class_students": no_of_1st_class_students,
        "no_of_students_to_repeat": no_of_students_to_repeat,
        "no_of_carry_over_students": no_of_carry_over_students,
    }

    return render(request, 'result/home.html', context)
github Abdoulrasheed / django-school-management / result / views.py View on Github external
def carry_over(request):
    if request.method == "POST":
        value = ()
        data = request.POST.copy()
        data.pop('csrfmiddlewaretoken', None) # remove csrf_token
        for val in data.values():
            value += (val,)
        course = value[0]
        session = value[1]
        courses = CarryOverStudent.objects.filter(course__courseCode=course, session=session)
        all_courses = Course.objects.all()
        sessions = Session.objects.all()
        signal_template = True
        context = {
                    "all_courses": all_courses,
                    "courses": courses,
                    "signal_template": signal_template, 
                    "sessions":sessions 
        }
        return render(request, 'course/carry_over.html', context)
    else:
        all_courses = Course.objects.all()
        sessions = Session.objects.all()
        return render(request, 'course/carry_over.html',  { "all_courses": all_courses, "sessions":sessions })
github Abdoulrasheed / django-school-management / result / models.py View on Github external
def carry_over(self, grade):
        if grade == F:
            CarryOverStudent.objects.get_or_create(student=self.student, course=self.course)
        else:
            try:
                CarryOverStudent.objects.get(student=self.student, course=self.course).delete()
            except:
                pass
github Abdoulrasheed / django-school-management / result / models.py View on Github external
def carry_over(self, grade):
        if grade == F:
            CarryOverStudent.objects.get_or_create(student=self.student, course=self.course)
        else:
            try:
                CarryOverStudent.objects.get(student=self.student, course=self.course).delete()
            except:
                pass