Skip to content

Commit 7509f73

Browse files
authored
Merge pull request #1841 from vikrantwiz02/prod/acad-react
Prod/acad react
2 parents b33b1e9 + ae021df commit 7509f73

File tree

1 file changed

+28
-2
lines changed
  • FusionIIIT/applications/programme_curriculum/api

1 file changed

+28
-2
lines changed

FusionIIIT/applications/programme_curriculum/api/views.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)