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))