def _save_or_update_json_response(cmd): try: cristianismo = cmd() except CommandExecutionException: return JsonResponse({'errors': cmd.errors}) short_form=facade.cristianismo_short_form() return JsonResponse(short_form.fill_with_model(cristianismo))
def index(): cmd = facade.list_cristianismos_cmd() cristianismos = cmd() edit_path = router.to_path(edit) delete_path = router.to_path(delete) short_form = facade.cristianismo_short_form() def short_cristianismo_dict(cristianismo): cristianismo_dct = short_form.fill_with_model(cristianismo) cristianismo_dct['edit_path'] = router.to_path(edit_path, cristianismo_dct['id']) cristianismo_dct['delete_path'] = router.to_path(delete_path, cristianismo_dct['id']) return cristianismo_dct short_cristianismos = [short_cristianismo_dict(cristianismo) for cristianismo in cristianismos] context = {'cristianismos': short_cristianismos, 'new_path': router.to_path(new)} return TemplateResponse(context)
def index(): cmd = facade.list_cristianismos_cmd() cristianismo_list = cmd() short_form=facade.cristianismo_short_form() cristianismo_short = [short_form.fill_with_model(m) for m in cristianismo_list] return JsonResponse(cristianismo_short)