0.0.16 send new route form
This commit is contained in:
@@ -13,7 +13,7 @@ function createRoute(){
|
||||
success: function(data){
|
||||
console.log('data received')
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".profile").innerHTML = data.html
|
||||
document.querySelector(".info_profile").innerHTML = data.html
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
20
static/js/sendNewRoute.js
Normal file
20
static/js/sendNewRoute.js
Normal file
@@ -0,0 +1,20 @@
|
||||
function sendRoute(){
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/user_account/new_route_view/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
// enctype: 'json',
|
||||
// data: {},
|
||||
success: function(data){
|
||||
console.log('data received')
|
||||
// location.href = '/profile'
|
||||
document.querySelector(".info_profile").innerHTML = data.html
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<div>
|
||||
|
||||
{{ andy }}
|
||||
</div>
|
||||
@@ -1,3 +1,80 @@
|
||||
<div>
|
||||
{{ form.as_div }}
|
||||
</div>
|
||||
<form name="new_route" method="post">
|
||||
{% csrf_token %}
|
||||
<div>
|
||||
<label for="id_type_transport">{{ form.fields.type_transport.label }}</label>
|
||||
<select name="type_transport" id="id_type_transport"{% if form.fields.type_transport.required %} required{% endif %}>
|
||||
{% for item in form.fields.type_transport.choices %}
|
||||
<option value="{{ item.0 }}"{% if form.fields.type_transport.initial == item.0 %} selected="selected"{% endif %}>{{ item.1 }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="id_departure_DT">{{ form.fields.departure_DT.label }}</label>
|
||||
<input type="datetime-local" name="departure_DT"{% if form.fields.departure_DT.required %} required{% endif %} id="id_departure_DT">
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_arrival_DT">{{ form.fields.arrival_DT.label }}</label>
|
||||
<input type="datetime-local" name="arrival_DT"{% if form.fields.arrival_DT.required %} required{% endif %} id="id_arrival_DT">
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_from_country">{{ form.fields.from_country.label }}</label>
|
||||
<input type="text" name="from_country"{% if form.fields.from_country.required %} required{% endif %} id="id_from_country">
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_to_country">{{ form.fields.to_country.label }}</label>
|
||||
<input type="text" name="to_country"{% if form.fields.to_country.required %} required{% endif %} id="id_to_country">
|
||||
</div>
|
||||
{# <div>#}
|
||||
{# <label for="id_from_city">{{ form.fields.from_city.label }}</label>#}
|
||||
{# <input type="text" name="from_city"{% if form.fields.from_city.required %} required{% endif %} id="id_from_city">#}
|
||||
{# </div>#}
|
||||
{# <div>#}
|
||||
{# <label for="id_to_city">{{ form.fields.to_city.label }}</label>#}
|
||||
{# <input type="text" name="to_city"{% if form.fields.to_city.required %} required{% endif %} id="id_to_city">#}
|
||||
{# </div>#}
|
||||
<div>
|
||||
<label for="id_from_place">{{ form.fields.from_place.label }}</label>
|
||||
<select name="from_place" id="id_from_place" {% if form.fields.from_place.required %} required{% endif %}>
|
||||
{% for item in form.fields.from_place.choices %}
|
||||
<option value="{{ item.0 }}"{% if form.fields.type_transport.initial == item.0 %} selected="selected"{% endif %}>{{ item.1 }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_to_place">{{ form.fields.to_place.label }}</label>
|
||||
<select name="to_place" id="id_to_place" {% if form.fields.to_place.required %} required{% endif %}>
|
||||
{% for item in form.fields.to_place.choices %}
|
||||
<option value="{{ item.0 }}"{% if form.fields.to_place.initial == item.0 %} selected="selected"{% endif %}>{{ item.1 }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_cargo_type">{{ form.fields.cargo_type.label }}</label>
|
||||
<select name="cargo_type" id="id_cargo_type" {% if form.fields.cargo_type.required %} required{% endif %}>
|
||||
{% for item in form.fields.cargo_type.choices %}
|
||||
<option value="{{ item.0 }}"{% if form.fields.cargo_type.initial == item.0 %} selected="selected"{% endif %}>{{ item.1 }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_weight">{{ form.fields.weight.label }}</label>
|
||||
<input type="number" name="weight"{% if form.fields.weight.required %} required{% endif %} id="id_weight">
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_phone">{{ form.fields.phone.label }}</label>
|
||||
<input type="text" name="phone"{% if form.fields.phone.required %} required{% endif %} id="id_phone">
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_add_phone">{{ form.fields.add_phone.label }}</label>
|
||||
<input type="text" name="add_phone" id="id_add_phone">
|
||||
</div>
|
||||
<div>
|
||||
<label for="id_receive_msg_by_email">{{ form.fields.receive_msg_by_email.label }}</label>
|
||||
<input type="checkbox" name="receive_msg_by_email" id="id_receive_msg_by_email">
|
||||
</div>
|
||||
<div class="button_register">
|
||||
<button id="registration" onclick="sendRoute(this)"> Разместить объявления </button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@@ -1,14 +1,14 @@
|
||||
<section class="login">
|
||||
<h1>Войдите в профиль</h1>
|
||||
<form name="registration_form" method="post">
|
||||
{% csrf_token %}
|
||||
<form class="login_form" name="login_form" method="post">
|
||||
{% csrf_token %}
|
||||
<div>
|
||||
{% if form.errors.all__ %}
|
||||
<div class="error_message">
|
||||
{{ form.errors.all__ }}
|
||||
</div>
|
||||
<span>
|
||||
{{ form.errors.all__ }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
<div class="inputs_l">
|
||||
<input name="username" type="text" placeholder="Логин" {% if form.data.username %} value="{{ form.data.username }}"{% endif %}>
|
||||
{% if form.username and form.errors.username %}
|
||||
|
||||
Reference in New Issue
Block a user