0.7.63
user_subscribe in all views
This commit is contained in:
@@ -14,11 +14,15 @@ class LoginForm(forms.Form):
|
||||
username = forms.CharField(required=True)
|
||||
password = forms.CharField(required=True)
|
||||
|
||||
|
||||
|
||||
class RegistrationForm(forms.Form):
|
||||
from .models import account_type_choices
|
||||
account_type = forms.ChoiceField(choices=account_type_choices, initial='sender', required=True)
|
||||
firstname = forms.CharField(required=False)
|
||||
lastname = forms.CharField(required=False)
|
||||
country = forms.CharField(required=False)
|
||||
city = forms.CharField(required=False)
|
||||
email = forms.EmailField()
|
||||
password = forms.CharField(widget=forms.PasswordInput())
|
||||
confirm_password = forms.CharField(widget=forms.PasswordInput())
|
||||
|
||||
@@ -26,7 +26,23 @@ def get_profile_page_content_html(request, page_name, data):
|
||||
|
||||
|
||||
def get_profile_change_page_content_html(request):
|
||||
|
||||
init_Dict = {
|
||||
'firstname': request.user.first_name,
|
||||
'lastname': request.user.last_name,
|
||||
'email': request.user.email,
|
||||
'tel': request.user.user_profile.phone,
|
||||
'country': request.user.user_profile.country,
|
||||
'city': request.user.user_profile.city,
|
||||
}
|
||||
from .forms import RegistrationForm
|
||||
form = RegistrationForm(initial=init_Dict)
|
||||
|
||||
from SubscribesApp.funcs import get_cur_user_subscribe
|
||||
|
||||
Dict = {
|
||||
'profileForm': form,
|
||||
'user_subscribe': get_cur_user_subscribe(request.user)
|
||||
}
|
||||
|
||||
html = render_to_string('blocks/profile/b_profile.html', Dict, request=request)
|
||||
|
||||
@@ -70,6 +70,7 @@ def change_profile_ajax(request):
|
||||
if request.method != 'POST':
|
||||
raise Http404
|
||||
|
||||
|
||||
html = get_profile_change_page_content_html(request)
|
||||
return JsonResponse({'html': html}, status=200)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user