def client_new_project_chat_message(request, pk): if request.method == 'POST': obj = ClientObject(request.user) try: with transaction.atomic(): if obj.new_project_chat_message(pk, request.POST.copy()): return JsonResponse(SUCCESS_DICT, status=200) else: raise IntegrityError except IntegrityError as e: return JsonResponse( { 'status': 'error', 'error': obj.get_error_message() + '\n' + str(e), 'errors': obj.get_form_errors() }, status=200) raise Http404
def client_edit_profile(request): if request.method == 'POST': obj = ClientObject(request.user) rq = RequestUtil() try: with transaction.atomic(): if obj.edit_profile(rq.get_client_profile_info(request)): return JsonResponse(SUCCESS_DICT, status=200) else: raise IntegrityError except IntegrityError as e: return JsonResponse( { 'status': 'error', 'error': obj.get_error_message() + '\n' + str(e), 'errors': obj.get_form_errors() }, status=200) raise Http404