From fc0d9f07c02db285b818e20772854dc7d7cb79eb Mon Sep 17 00:00:00 2001 From: SDE Date: Mon, 21 Oct 2024 12:52:51 +0300 Subject: [PATCH 1/4] 1.7.6 fix get_profile_change_page_content_html --- AuthApp/funcs.py | 22 +++++++++++++++++++++- AuthApp/js_views.py | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/AuthApp/funcs.py b/AuthApp/funcs.py index 4d0baa7..53c5853 100644 --- a/AuthApp/funcs.py +++ b/AuthApp/funcs.py @@ -1,3 +1,4 @@ +from django.http import QueryDict from django.template.loader import render_to_string from SubscribesApp.funcs import check_option_in_cur_user_subscribe @@ -56,7 +57,7 @@ def get_profile_page_content_html(request, page_name, data): return None -def get_profile_change_page_content_html(request): +def get_profile_change_page_content_html(request, data=None): init_Dict = { 'firstname': request.user.first_name, @@ -66,6 +67,25 @@ def get_profile_change_page_content_html(request): 'country': request.user.user_profile.country, 'city': request.user.user_profile.city, } + + if data: + if type(data) == QueryDict: + data = data.dict() + init_Dict.update(data) + # if 'firstname' in data: + # init_Dict.update({'first_name': data['firstname']}) + # if 'lastname' in data: + # init_Dict.update({'last_name': data['lastname']}) + # if 'email' in data: + # init_Dict.update({'email': data['email']}) + # init_Dict.update({'username': data['email']}) + # if 'country' in data: + # init_Dict.update({'country': data['country']}) + # if 'city' in data: + # init_Dict.update({'city': data['city']}) + # if 'tel' in data: + # init_Dict.update({'tel': data['tel']}) + from .forms import RegistrationForm form = RegistrationForm(initial=init_Dict) diff --git a/AuthApp/js_views.py b/AuthApp/js_views.py index bfe0742..ce47f79 100644 --- a/AuthApp/js_views.py +++ b/AuthApp/js_views.py @@ -501,7 +501,7 @@ def change_profile_confirm_ajax(request): if data_for_save: user_profiles.update(**data_for_save) - html = get_profile_change_page_content_html(request) + html = get_profile_change_page_content_html(request, data) from GeneralApp.funcs import get_add_to_ajax_response_Dict res_Dict = {'html': html} res_Dict.update(get_add_to_ajax_response_Dict(request.user)) From a839114cdf80f0ee7d761b8002a5c01dc4f9d571 Mon Sep 17 00:00:00 2001 From: SDE Date: Mon, 21 Oct 2024 13:24:08 +0300 Subject: [PATCH 2/4] 1.7.7 fix js dublicates login section --- static/js/authorization.js | 2 +- templates/forms/f_login.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/authorization.js b/static/js/authorization.js index 0c59dfe..d670ec9 100644 --- a/static/js/authorization.js +++ b/static/js/authorization.js @@ -39,7 +39,7 @@ function SendLoginForm(el){ }, error: function (data, exception){ - document.querySelector(".login").innerHTML = data.responseJSON.html + document.querySelector(".wrapper_content").innerHTML = data.responseJSON.html document.getElementsByClassName('recovery')[0].classList.remove('hide') } }); diff --git a/templates/forms/f_login.html b/templates/forms/f_login.html index 8bdf909..fcfe4f9 100644 --- a/templates/forms/f_login.html +++ b/templates/forms/f_login.html @@ -5,7 +5,7 @@ {% trans "Пароль" as p_password %}