2.1.20 reference_data_tags

This commit is contained in:
SDE
2025-01-15 19:17:26 +03:00
parent 2d650cd51f
commit 575ee074b1
6 changed files with 32 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
from datetime import datetime
import pytz
def get_cur_DT_by_timezone(timezone, DT=None):
if not DT:
DT = datetime.now()
if not timezone:
return DT
return DT.astimezone(tz=pytz.timezone(timezone))

View File

@@ -70,7 +70,7 @@ def search_city_ajax(request):
res_Dict = { res_Dict = {
'res_search_list': html 'res_search_list': html,
} }
from GeneralApp.funcs import get_add_to_ajax_response_Dict from GeneralApp.funcs import get_add_to_ajax_response_Dict

View File

@@ -0,0 +1 @@
__author__ = 'SDE'

View File

@@ -0,0 +1,17 @@
__author__ = 'SDE'
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from BaseModels.datetime_funcs import get_cur_DT_by_timezone
register = template.Library()
@register.filter
@stringfilter
def get_cur_DT_by_tz(timezone, DT=None):
return get_cur_DT_by_timezone(timezone, DT)

View File

@@ -55,6 +55,7 @@ class RouteForm(forms.ModelForm):
error = get_phone_valid_error(cleaned_data["phone"]) error = get_phone_valid_error(cleaned_data["phone"])
if error: if error:
self.add_error('phone', error) self.add_error('phone', error)
cleaned_data['phone'] = self.data['phone']
# if 'extra_phone' in cleaned_data and 'extra_phone' in cleaned_data: # if 'extra_phone' in cleaned_data and 'extra_phone' in cleaned_data:
# from BaseModels.validators.form_field_validators import get_phone_valid_error # from BaseModels.validators.form_field_validators import get_phone_valid_error

View File

@@ -1,5 +1,6 @@
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}
{% load reference_data_tags %}
<div class="cw_w_select_widget_for_select" data-id="{{ id }}" data-name="{{ name }}/{{ country__name }}" data-country_code="{{ country__short_code }}" data-flag="{{ MEDIA_URL }}{{ country__flag }}" onclick="selectCountry(this)"> <div class="cw_w_select_widget_for_select" data-id="{{ id }}" data-name="{{ name }}/{{ country__name }}" data-country_code="{{ country__short_code }}" data-flag="{{ MEDIA_URL }}{{ country__flag }}" onclick="selectCountry(this)">
<div class="cw_country_inf_part"> <div class="cw_country_inf_part">