def section(request, section_id): section_obj = get_object_or_404(Section, pk=section_id) section_api = SectionApi(None) # FIXME: ugly hack, but works section = section_api.serialize_section(section_obj) return JSONResponse.build(section, request)
def sections(request, program_id): program = get_object_or_404(Program, pk=program_id) section_api = SectionApi(program) sections = section_api.serialize_sections() return JSONResponse.build(sections, request)