0.1.5
edit route url
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user