Django annotate field value from external dictionary
Lets say I have a following dict: schools_dict = { ‘1’: {‘points’: 10}, ‘2’: {‘points’: 14}, ‘3’: {‘points’: 5}, } And how can I put these values into my queryset using annotate? I would like to do smth like this, but its not working schools = SchoolsExam.objects.all() queryset = schools.annotate( total_point = schools_dict[F(‘school__school_id’)][‘points’] ) Models:… Read More Django annotate field value from external dictionary