profile page
This commit is contained in:
SDE
2023-06-22 22:17:01 +03:00
parent 3def6abb84
commit 957065a091
5 changed files with 44 additions and 13 deletions

View File

@@ -26,16 +26,23 @@ def registration_ajax(request):
html = render_to_string('forms/f_registration.html', Dict)
return JsonResponse({'html': html}, status=400)
user = User.objects.create_user(username=form.data['email'], email=form.data['email'], password=form.data['password'])
# user = auth.authenticate(username=new_user_Dict['name'], password=new_user_Dict['pass'])
if user:
auth.login(request, user)
res_data = {
'errors': 'тестовый верный ответ'
}
res_Dict = {}
JsonResponse(res_Dict)
except Exception as e:
res_data = {
'errors': f'ошибка в запросе = {str(e)}'
errors_Dict = {
'errors': {
'__all__': f'ошибка в запросе = {str(e)}'
}
}
Dict = {'form': errors_Dict}
html = render_to_string('forms/f_registration.html', Dict)
return JsonResponse({'html': html}, status=400)
return JsonResponse(res_data)