diff --git a/AuthApp/js_urls.py b/AuthApp/js_urls.py index cbb35e4..5a15a85 100644 --- a/AuthApp/js_urls.py +++ b/AuthApp/js_urls.py @@ -18,7 +18,7 @@ urlpatterns = [ path('new_msg_to_user/', new_msg_to_user_ajax, name='new_msg_to_user' ), path('new_msg_to_support/', new_msg_to_support_ajax, name='new_msg_to_support_ajax'), - path('support_create_ticket_ajax/', support_create_ticket_ajax, name='support_create_ticket_ajax'), + path('change_profile/', change_profile_ajax, name='change_profile_ajax'), ] \ No newline at end of file diff --git a/AuthApp/js_views.py b/AuthApp/js_views.py index 32f9018..6d7f532 100644 --- a/AuthApp/js_views.py +++ b/AuthApp/js_views.py @@ -47,19 +47,7 @@ def new_msg_to_support_ajax(request): return JsonResponse({'html': html}, status=200) -@login_required(login_url='/profile/login/') -def support_create_ticket_ajax(request): - from ChatServiceApp.forms import CreateTicketForm - if request.method != 'POST': - raise Http404 - - Dict = { - 'forms': CreateTicketForm() - } - - html = render_to_string('blocks/profile/b_create_ticket.html', Dict, request=request) - return JsonResponse({'html': html}, status=200) @login_required(login_url='/profile/login/') diff --git a/ChatServiceApp/js_urls.py b/ChatServiceApp/js_urls.py new file mode 100644 index 0000000..c9f1c51 --- /dev/null +++ b/ChatServiceApp/js_urls.py @@ -0,0 +1,13 @@ +# coding=utf-8 +from django.urls import path +# from AuthApp.js_views import * +# from AuthApp.import_funcs import * +from .js_views import * +from django.contrib.auth import views +from RoutesApp.js_views import new_route_view_ajax + +urlpatterns = [ + path('support_create_ticket_ajax/', support_create_ticket_ajax, name='support_create_ticket_ajax'), + # path('create_/', registration_ajax, name='registration_ajax'), + +] \ No newline at end of file diff --git a/ChatServiceApp/js_views.py b/ChatServiceApp/js_views.py new file mode 100644 index 0000000..a2783a9 --- /dev/null +++ b/ChatServiceApp/js_views.py @@ -0,0 +1,27 @@ +from django.shortcuts import render + +from uuid import uuid1 +from .models import * +from django.contrib import auth +from django.http import HttpResponse, Http404, JsonResponse +from django.template import loader, RequestContext +from django.contrib.auth.decorators import login_required +from BaseModels.mailSender import techSendMail +from django.utils.translation import gettext as _ +from datetime import datetime +from django.template.loader import render_to_string +from django.urls import reverse + +@login_required(login_url='/profile/login/') +def support_create_ticket_ajax(request): + from ChatServiceApp.forms import CreateTicketForm + + if request.method != 'POST': + raise Http404 + + Dict = { + 'forms': CreateTicketForm() + } + + html = render_to_string('blocks/profile/b_create_ticket.html', Dict, request=request) + return JsonResponse({'html': html}, status=200) \ No newline at end of file diff --git a/RoutesApp/js_views.py b/RoutesApp/js_views.py index d4dcac8..15f889c 100644 --- a/RoutesApp/js_views.py +++ b/RoutesApp/js_views.py @@ -21,7 +21,7 @@ def edit_route_ajax(request): if request.method != 'POST': raise Http404 - data = request.POST + data = request.body Dict = {} @@ -29,7 +29,7 @@ def edit_route_ajax(request): if not 'route_id' in data: msg = f'Недостаточно данных' - return {'errors': msg} + return JsonResponse({'errors': msg}) route = Route.objects.get(data['route_id']) diff --git a/TWB/urls.py b/TWB/urls.py index d2a4233..b29fc41 100644 --- a/TWB/urls.py +++ b/TWB/urls.py @@ -21,6 +21,7 @@ urlpatterns += i18n_patterns( path('user_account/', include('AuthApp.js_urls')), path('routes/', include('RoutesApp.js_urls')), + path('messages/', include('ChatServiceApp.js_urls')), path('reference_data/', include('ReferenceDataApp.js_urls')),