def _save_or_update_json_response(cmd): try: course = cmd() except CommandExecutionException: return JsonResponse({'errors': cmd.errors}) short_form=facade.course_short_form() return JsonResponse(short_form.fill_with_model(course))
def _save_or_update_json_response(cmd): try: course = cmd() except CommandExecutionException: return JsonResponse({'errors': cmd.errors}) short_form = facade.course_short_form() return JsonResponse(short_form.fill_with_model(course))
def index(): cmd = facade.list_courses_cmd() courses = cmd() edit_path = router.to_path(edit) delete_path = router.to_path(delete) short_form = facade.course_short_form() def short_course_dict(course): course_dct = short_form.fill_with_model(course) course_dct['edit_path'] = router.to_path(edit_path, course_dct['id']) course_dct['delete_path'] = router.to_path(delete_path, course_dct['id']) return course_dct short_courses = [short_course_dict(course) for course in courses] context = {'courses': short_courses, 'new_path': router.to_path(new)} return TemplateResponse(context)
def index(): cmd = facade.list_courses_cmd() course_list = cmd() short_form=facade.course_short_form() course_short = [short_form.fill_with_model(m) for m in course_list] return JsonResponse(course_short)
def index(): cmd = facade.list_courses_cmd() course_list = cmd() short_form = facade.course_short_form() course_short = [short_form.fill_with_model(m) for m in course_list] return JsonResponse(course_short)