2.1.20 reference_data_tags
This commit is contained in:
11
BaseModels/datetime_funcs.py
Normal file
11
BaseModels/datetime_funcs.py
Normal 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))
|
||||
@@ -70,7 +70,7 @@ def search_city_ajax(request):
|
||||
|
||||
|
||||
res_Dict = {
|
||||
'res_search_list': html
|
||||
'res_search_list': html,
|
||||
}
|
||||
|
||||
from GeneralApp.funcs import get_add_to_ajax_response_Dict
|
||||
|
||||
1
ReferenceDataApp/templatetags/__init__.py
Normal file
1
ReferenceDataApp/templatetags/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
__author__ = 'SDE'
|
||||
17
ReferenceDataApp/templatetags/reference_data_tags.py
Normal file
17
ReferenceDataApp/templatetags/reference_data_tags.py
Normal 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)
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ class RouteForm(forms.ModelForm):
|
||||
error = get_phone_valid_error(cleaned_data["phone"])
|
||||
if error:
|
||||
self.add_error('phone', error)
|
||||
cleaned_data['phone'] = self.data['phone']
|
||||
|
||||
# if 'extra_phone' in cleaned_data and 'extra_phone' in cleaned_data:
|
||||
# from BaseModels.validators.form_field_validators import get_phone_valid_error
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% load static %}
|
||||
{% 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_country_inf_part">
|
||||
|
||||
Reference in New Issue
Block a user