edit route url
This commit is contained in:
SDE
2023-07-31 19:16:09 +03:00
parent 583bcfc9a8
commit dce31b11b7
3 changed files with 35 additions and 0 deletions

View File

@@ -17,6 +17,37 @@ from .forms import *
from .funcs import get_routes_for_user
def edit_route_ajax(request):
if request.method != 'POST':
raise Http404
data = request.POST
Dict = {}
try:
if not 'route_id' in data:
msg = f'Недостаточно данных'
return {'errors': msg}
route = Route.objects.get(data['route_id'])
form = CreateRouteForm(route)
Dict = {
'form': form
}
except Exception as e:
# form.errors.append({'__all__': f'Ошибка: {str(e)}'})
print(str(e))
html = render_to_string('blocks/profile/b_new_route.html', Dict, request=request)
return JsonResponse({'html': html}, status=200)
def new_route_view_ajax(request):
if request.method != 'POST':
raise Http404