for (call in data['mas'])
i += 1
body.append($('<button type="button" id="number_id" class="f16" onclick="ama()">Выход</button>'))
body.append("<div class='call'>" + "</div>")
$('.call').append($("<div class='call_content'>" + "</div>"))
call_content = $('.call_content')
call_content.append($(
"<h1 class='name_call'>" + data['mas'][call]['name_call'] + "</div>" +
'<h2 class="district" style="margin-bottom: 8px;">' + 'Район: ' + data['mas'][call]['district_call'] + '</div>' +
'<h2 class="gun" style="margin-bottom: 8px;">' + 'Вооружение: ' + data['mas'][call]['gun_call'] + '</div>' +
'<h2 class="signs" style="margin-bottom: 3px;">' + 'Приметы: ' + data['mas'][call]['signs_call'] + '</div>'
))
if(data['mas'][call]['status_call'] === '0'){
call_content.append($('<h3 class="call_status" id="CheckReady" style="cursor: pointer">Принять</h3>'))
}
if(data['mas'][call]['status_call'] === '1'){
call_content.append($(
'<h3 class="call_status" id="CheckReady" style="cursor: pointer">Ожидание</h3>' +
'<div class="cop"></div>'
))
cop = $('.cop')
// cop.append($(
// '<img src="{% static 'cop.svg' %}" class="dropbtn">' +
// '<div class="dropdown-content">'
// ))
$('.dropdown-content').append($(
'<a href="#" id="done">Выполнено</a>' +
'<a href="#" id="failed">Провалено</a>'
))
}
<form class="auth_cont" enctype="multipart/form-data" method="POST">
{% csrf_token %}
<h2 id="dim">*Рекомендуемое разрешение не меньше 250 на 291</h2>
<h1>Название фото</h1>
{{ form.name_photo }}
<h1>Ссылка на фотографию</h1>
{{ form.href_photo }}
<h1>Описание</h1>
{{ form.desc_photo }}
<h1>{{ success }}</h1>
<h1>{{ error_create }}</h1>
<button type="submit" class="create-button">Создать</button>
</form>
if request.method == 'POST':
form = PhotoForm(request.POST, request.FILES)
if form.is_valid():
if 'login' in request.session:
login = request.session['login']
photos = Photo.objects.all()
name_photo = form.cleaned_data['name_photo']
href_photo = form.cleaned_data['href_photo']
desc_photo = form.cleaned_data['desc_photo']
if все хорошо:
photo = Photo()
photo.name_photo = name_photo
photo.href_photo = href_photo
photo.author_photo = login
photo.desc_photo = desc_photo
photo.save()
return HttpResponseRedirect(f'photo/{name_photo}')
else:
return HttpResponseRedirect('/auth')