0.12.17 change_avatar_confirm_ajax RequestDataTooBig

This commit is contained in:
SDE
2024-02-05 23:02:11 +03:00
parent f86be5bd97
commit 1479584bfc
3 changed files with 5 additions and 4 deletions

View File

@@ -265,12 +265,12 @@ def change_avatar_confirm_ajax(request):
except RequestDataTooBig: except RequestDataTooBig:
msg = _('Слишком большой размер файла. Размер файла не должен быть больше 3МБ') msg = _('Слишком большой размер файла. Размер файла не должен быть больше 3МБ')
print(msg) print(msg)
JsonResponse({'error': msg}, status=400) return JsonResponse({'error': msg}, status=400)
except Exception as e: except Exception as e:
msg = f'change_avatar_confirm_ajax Error = {str(e)}' msg = f'change_avatar_confirm_ajax Error = {str(e)}'
print(msg) print(msg)
JsonResponse({'error': msg}, status=400) return JsonResponse({'error': msg}, status=400)
return JsonResponse({'url': request.user.user_profile.avatar.url}) return JsonResponse({'url': request.user.user_profile.avatar.url})

View File

@@ -270,6 +270,7 @@ django.conf.locale.LANG_INFO = LANG_INFO
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
DATA_UPLOAD_MAX_MEMORY_SIZE = 4145728
CKEDITOR_BASEPATH = "/static/ckeditor/ckeditor/" CKEDITOR_BASEPATH = "/static/ckeditor/ckeditor/"
CKEDITOR_UPLOAD_PATH = "uploads/" CKEDITOR_UPLOAD_PATH = "uploads/"

View File

@@ -469,8 +469,8 @@ async function upload_photo_f_profile (el,files) {
}, },
error: function (data){ error: function (data){
document.querySelector(".avatar_user_profile").innerHTML = data.responseJSON.html; alert(data.responseJSON.error);
el.value = ''
} }
}); });
// } // }