2.1.5 get_routes_Dict fix from\to city v2

This commit is contained in:
SDE
2024-12-26 17:27:17 +03:00
parent c94c1a9202
commit 04c4e8c791
3 changed files with 12 additions and 8 deletions

View File

@@ -377,7 +377,10 @@ def create_or_change_route_ajax(request, route_id=None):
if not form.is_valid(): if not form.is_valid():
form.initial = form.cleaned_data form.initial = form.cleaned_data
Dict.update({'form': form}) Dict.update({
'form': form,
'owner_type': data['owner_type'],
})
html = render_to_string('blocks/profile/b_create_form_poster.html', Dict, request=request) html = render_to_string('blocks/profile/b_create_form_poster.html', Dict, request=request)
return JsonResponse({'html': html}, status=400) return JsonResponse({'html': html}, status=400)

View File

@@ -119,13 +119,14 @@
<input type="text" autocomplete="off" name="from_address_point_txt" id="from" class="poster__locate locate" <input type="text" autocomplete="off" name="from_address_point_txt" id="from" class="poster__locate locate"
placeholder="{% translate "Укажите город" %}" required placeholder="{% translate "Укажите город" %}" required
{% if form.initial.from_address_point_txt %}value="{{ form.initial.from_address_point_txt }}"{% endif %} {% if form.initial.from_city %}value="{{ form.initial.from_city.name }} {{ form.initial.from_city.country.short_code }} / {{ form.initial.from_city.country.name }}"{% endif %}
> >
{# <div class="poster__inp-country">#}
{# <img src="/media/uploads/flags/HU_-_Hungary.svg" alt="Венгрия">#} <div class="poster__inp-country">
{# <span>BY</span>#} <img src="{{ MEDIA_URL }}{{ form.initial.from_city.country.flag }}" alt="{{ form.initial.from_city.country.name }}">
{# </div>#} <span>{{ form.initial.from_city.country.short_code }}</span>
</div>
</div> </div>
<div class="poster__towns-list"></div> <div class="poster__towns-list"></div>
{% if not errors_off and form.errors and form.errors.from_address_point %} {% if not errors_off and form.errors and form.errors.from_address_point %}
@@ -251,7 +252,7 @@
id="arrival_DT" id="arrival_DT"
name="arrival_DT" name="arrival_DT"
placeholder="{% translate "Выберите дату" %}" placeholder="{% translate "Выберите дату" %}"
required {# required#}
{% if route.arrival_DT %} {% if route.arrival_DT %}
value="{{ route.from_city.get_current_datetime }}" value="{{ route.from_city.get_current_datetime }}"
{% elif form.initial.arrival_DT %} {% elif form.initial.arrival_DT %}

View File

@@ -4,6 +4,6 @@
<div class="poster__towns-item" data-attrs='[{{ id }}, "{{ name }}/{{ country__name }}", "{{ ctrl_name }}", "{{ timezone }}", "{{ MEDIA_URL }}{{ country__flag }}"]'> <div class="poster__towns-item" data-attrs='[{{ id }}, "{{ name }}/{{ country__name }}", "{{ ctrl_name }}", "{{ timezone }}", "{{ MEDIA_URL }}{{ country__flag }}"]'>
<img src="{{ MEDIA_URL }}{{ country__flag }}" alt="{{ country__name }}" /> <img src="{{ MEDIA_URL }}{{ country__flag }}" alt="{{ country__name }}" />
<span>BY{# {{ TODO нужны правильные значения }} #}</span> <span>{{ country__short_code }}</span>
{{ name }}/{{ country__name }} {{ name }}/{{ country__name }}
</div> </div>