Scenario
I have a table student. it has the following attributes
name,
age,
school_passout_date,
college_start_date
I need a report to find out that a student is avg number of daysfree from going to school and elementary college.
Current approach
I am currently annoyed by the range of values that determine the days for each student and receive them.
Problem
This is very inefficient when the record set becomes larger.
Question
Are there any abilities in ORM Django that give me summary days between two dates?
Opportunity
I am looking for something like this.
Students.objects.filter(school_passed=True, started_college=True).annotate(total_days_between=Count('school_passout_date', 'college_start_date'), Avg_days=Avg('school_passout_date', 'college_start_date'))
Best
source
share