2👍
✅
IMO Courses looks like this:
[[[a,b,c],[d,e,f]]]
Try this
courses = []
comp_course = []
for payment in transactions:
if payment.payment_type == "1":
unit = Units.objects.get(webducate_id=str(payment.course))
comp_course.append(str(unit.course.webducate_id))
units = Units.objects.filter(course=unit.course)
unit_list = []
for unit in units:
if unit.webducate_id == payment.course and payment.successfull == "1":
courses.append([str(unit.course.webducate_id),'1',str(unit.webducate_id)])
else:
courses.append([str(unit.course.webducate_id),'0',str(unit.webducate_id)])
comp_course = list(set(comp_course))
return render_to_response('student-account.html', {'Courses': courses, 'Comp_Course': comp_course,'Message': "", 'Transactions': transactions}, context_instance=RequestContext(request))
Source:stackexchange.com