0.1.18
edit_route fixed
This commit is contained in:
@@ -40,7 +40,11 @@ def support_tickets_ajax(request):
|
||||
if request.method != 'POST':
|
||||
raise Http404
|
||||
|
||||
from ChatServiceApp.models import MsgGroup
|
||||
tickets = MsgGroup.objects.filter(enable=True, owner=request.user)
|
||||
|
||||
Dict = {
|
||||
'tickets': tickets
|
||||
}
|
||||
|
||||
html = render_to_string('blocks/profile/b_support_tickets.html', Dict, request=request)
|
||||
|
||||
@@ -52,6 +52,7 @@ def create_ticket_ajax(request):
|
||||
|
||||
obj = form.save(commit=False)
|
||||
obj.owner = request.user
|
||||
obj.enable = True
|
||||
obj.save()
|
||||
|
||||
Dict = {
|
||||
|
||||
@@ -5,8 +5,9 @@ from django.urls import path
|
||||
from .js_views import *
|
||||
|
||||
urlpatterns = [
|
||||
path('change_route/<int:route_id>/', create_or_change_route_ajax, name='change_route_ajax'),
|
||||
path('create_or_change_route/', create_or_change_route_ajax, name='create_or_change_route_ajax'),
|
||||
path('create_or_change_route/<int:route_id>/', create_or_change_route_ajax, name='change_route_ajax'),
|
||||
|
||||
path('edit_route/', edit_route_ajax, name='edit_route_ajax'),
|
||||
|
||||
path('get_routes/', get_routes_ajax, name='get_routes_ajax'),
|
||||
|
||||
@@ -182,6 +182,8 @@ def create_or_change_route_ajax(request, route_id):
|
||||
if request.method != 'POST':
|
||||
raise Http404
|
||||
|
||||
Dict = {}
|
||||
|
||||
try:
|
||||
|
||||
data = request.POST
|
||||
@@ -192,12 +194,14 @@ def create_or_change_route_ajax(request, route_id):
|
||||
|
||||
if route:
|
||||
form = RouteForm(data, instance=route)
|
||||
Dict.update({'route': route})
|
||||
else:
|
||||
form = RouteForm(data)
|
||||
|
||||
if not form.is_valid():
|
||||
form.initial = form.cleaned_data
|
||||
Dict = {'form': form}
|
||||
Dict.update({'form': form})
|
||||
|
||||
html = render_to_string('blocks/profile/b_new_route.html', Dict, request=request)
|
||||
return JsonResponse({'html': html}, status=400)
|
||||
|
||||
@@ -209,7 +213,7 @@ def create_or_change_route_ajax(request, route_id):
|
||||
|
||||
if 'errors' in routes_Dict:
|
||||
form.errors.update(routes_Dict['errors'])
|
||||
Dict = {'form': form}
|
||||
Dict.update({'form': form})
|
||||
html = render_to_string('blocks/profile/b_new_route.html', Dict, request=request)
|
||||
return JsonResponse({'html': html}, status=400)
|
||||
|
||||
@@ -228,6 +232,7 @@ def create_or_change_route_ajax(request, route_id):
|
||||
'all__': f'ошибка в запросе = {str(e)}'
|
||||
}
|
||||
}
|
||||
Dict = {'form': errors_Dict}
|
||||
# Dict = {'form': errors_Dict}
|
||||
Dict.update({'form': errors_Dict})
|
||||
html = render_to_string('blocks/profile/b_new_route.html', Dict, request=request)
|
||||
return JsonResponse({'html': html}, status=400)
|
||||
@@ -17,12 +17,13 @@
|
||||
</div>
|
||||
<div class="container-requests-tech-sprt">
|
||||
<div class="cont-req-tech-sup">Мои обращения:</div>
|
||||
{% for ticket in tickets %}
|
||||
{% include "widgets/w_request_tech_support.html" %}
|
||||
{% endfor %}
|
||||
|
||||
{% include "widgets/w_request_tech_support.html" %}
|
||||
|
||||
{% include "widgets/w_request_tech_support.html" %}
|
||||
|
||||
{% include "widgets/w_request_tech_support.html" %}
|
||||
{# {% include "widgets/w_request_tech_support.html" %}#}
|
||||
{##}
|
||||
{# {% include "widgets/w_request_tech_support.html" %}#}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
{% load static %}
|
||||
<div class="container-message-req-sprt">
|
||||
<div class="message-sprt-title">
|
||||
<span>Текст последнего сообщени в чате (с размытием)</span>
|
||||
<span>
|
||||
{# Текст последнего сообщени в чате (с размытием)#}
|
||||
{{ ticket.name }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="message-sprt-inf">
|
||||
<div>
|
||||
<span>Статус: Открыт</span>
|
||||
<span>
|
||||
Статус: {{ ticket.get_status_display }}
|
||||
{# Статус: Открыт#}
|
||||
</span>
|
||||
{# <img>#}
|
||||
<span>10.02.2023</span>
|
||||
<span>
|
||||
{# 10.02.2023#}
|
||||
{{ ticket.modifiedDT }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user