File tree Expand file tree Collapse file tree 1 file changed +28
-2
lines changed
FusionIIIT/applications/programme_curriculum/api Expand file tree Collapse file tree 1 file changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -141,12 +141,38 @@ def view_curriculums_of_a_programme(request, programme_id):
141141 'working_curriculums' : [
142142 {
143143 ** model_to_dict (c ),
144- 'batches' : [model_to_dict (b ) for b in c .batches .all ()]
144+ 'batches' : [
145+ {
146+ 'id' : b .id ,
147+ 'name' : b .name ,
148+ 'discipline' : b .discipline .acronym ,
149+ 'year' : b .year ,
150+ 'running_batch' : b .running_batch ,
151+ # 'total_seats': b.total_seats,
152+ }
153+ for b in c .batches .all ()
154+ ]
145155 # Add batches for each curriculum
146156 }
147157 for c in working_curriculums
148158 ],
149- 'past_curriculums' : [model_to_dict (c ) for c in past_curriculums ],
159+ 'past_curriculums' : [
160+ {
161+ ** model_to_dict (c ),
162+ 'batches' : [
163+ {
164+ 'id' : b .id ,
165+ 'name' : b .name ,
166+ 'discipline' : b .discipline .acronym , # Use acronym instead of ID
167+ 'year' : b .year ,
168+ 'running_batch' : b .running_batch ,
169+ # 'total_seats': b.total_seats,
170+ }
171+ for b in c .batches .all ()
172+ ]
173+ }
174+ for c in past_curriculums
175+ ],
150176 # 'notifications': [model_to_dict(n) for n in request.user.notifications.all()]
151177 }
152178
You can’t perform that action at this time.
0 commit comments