1.7.6 fix get_profile_change_page_content_html
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user