0.7.77
dashboard page
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
def get_dashboard_page_content_html(request):
|
||||
|
||||
Dict = {
|
||||
}
|
||||
|
||||
html = render_to_string('blocks/profile/b_profile_first_page.html', Dict, request=request)
|
||||
return html
|
||||
|
||||
def get_profile_page_content_html(request, page_name, data):
|
||||
|
||||
if page_name == 'chat':
|
||||
@@ -21,6 +29,8 @@ def get_profile_page_content_html(request, page_name, data):
|
||||
return get_profile_subscribe_page_content_html(request)
|
||||
elif page_name == 'change_profile':
|
||||
return get_profile_change_page_content_html(request)
|
||||
elif page_name == 'dashboard':
|
||||
return get_dashboard_page_content_html(request)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ urlpatterns = [
|
||||
|
||||
path('new_route_view/', new_route_view_ajax, name='new_route_view_ajax'),
|
||||
|
||||
path('dashboard/', dashboard_ajax, name='dashboard_ajax'),
|
||||
|
||||
|
||||
path('my_routes/', my_routes_ajax, name='my_routes_ajax'),
|
||||
# path('subscribe/', subscribe_ajax, name='subscribe_ajax'),
|
||||
|
||||
@@ -152,6 +152,25 @@ def change_profile_confirm_ajax(request):
|
||||
html = get_profile_change_page_content_html(request)
|
||||
return JsonResponse({'html': html}, status=200)
|
||||
|
||||
|
||||
@login_required(login_url='/profile/login/')
|
||||
def dashboard_ajax(request):
|
||||
if request.method != 'POST':
|
||||
raise Http404
|
||||
|
||||
try:
|
||||
|
||||
from .funcs import get_dashboard_page_content_html
|
||||
html = get_dashboard_page_content_html(request)
|
||||
|
||||
except Exception as e:
|
||||
msg = f'dashboard_ajax Error = {str(e)}'
|
||||
print(msg)
|
||||
html = msg
|
||||
|
||||
return JsonResponse({'html': html}, status=200)
|
||||
|
||||
|
||||
@login_required(login_url='/profile/login/')
|
||||
def change_profile_ajax(request):
|
||||
if request.method != 'POST':
|
||||
@@ -208,7 +227,7 @@ def login_ajax(request):
|
||||
|
||||
|
||||
res_Dict = {
|
||||
'redirect_url': reverse('user_profile')
|
||||
'redirect_url': reverse('profile_page', args=['dashboard'])
|
||||
}
|
||||
|
||||
return JsonResponse(res_Dict)
|
||||
@@ -259,7 +278,7 @@ def registration_ajax(request):
|
||||
user.user_profile.save()
|
||||
|
||||
res_Dict = {
|
||||
'redirect_url': reverse('user_profile')
|
||||
'redirect_url': reverse('profile_page', args=['dashboard'])
|
||||
}
|
||||
|
||||
return JsonResponse(res_Dict)
|
||||
|
||||
@@ -8,7 +8,7 @@ from django.contrib.auth import views
|
||||
urlpatterns = [
|
||||
|
||||
path('registration/', registration_View, name='registration_page'),
|
||||
path('', user_profile_View, name='user_profile'),
|
||||
# path('', user_profile_View, name='user_profile'),
|
||||
# path('page/chat/<int:user_id>/', chat_w_user_View, name='chat_w_user'),
|
||||
# path('page/chat/', chat_w_user_View, name='chat_w_user_wo_user_id'),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user