0.1.19
support tickets routines
This commit is contained in:
@@ -11,10 +11,33 @@ from django.utils.translation import gettext as _
|
||||
from datetime import datetime
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
from .funcs import *
|
||||
import json
|
||||
|
||||
@login_required(login_url='/profile/login/')
|
||||
def support_show_chat_by_ticket_ajax(request):
|
||||
|
||||
if request.method != 'POST':
|
||||
raise Http404
|
||||
|
||||
try:
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
obj = MsgGroup.objects.get(id=data['ticket_id'])
|
||||
|
||||
Dict = {
|
||||
'ticket': obj
|
||||
}
|
||||
|
||||
tpl_name = 'blocks/profile/b_support_chat.html'
|
||||
|
||||
html = render_to_string(tpl_name, Dict, request=request)
|
||||
return JsonResponse({'html': html}, status=200)
|
||||
|
||||
except Exception as e:
|
||||
msg = f'support_show_chat_by_ticket_ajax Error = {str(e)}'
|
||||
return JsonResponse({'error': msg}, status=400)
|
||||
|
||||
|
||||
@login_required(login_url='/profile/login/')
|
||||
@@ -24,11 +47,13 @@ def support_create_ticket_form_ajax(request):
|
||||
if request.method != 'POST':
|
||||
raise Http404
|
||||
|
||||
|
||||
Dict = {
|
||||
'form': TicketForm()
|
||||
}
|
||||
tpl_name = 'blocks/profile/b_create_ticket.html'
|
||||
|
||||
html = render_to_string('blocks/profile/b_create_ticket.html', Dict, request=request)
|
||||
html = render_to_string(tpl_name, Dict, request=request)
|
||||
return JsonResponse({'html': html}, status=200)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user