From ec58ac03c022cc7b31b1551c7e96dc436d784092 Mon Sep 17 00:00:00 2001 From: Nazar Kotjuk Date: Mon, 28 Sep 2015 21:31:42 +0300 Subject: [PATCH] Task 162 --- functions/form_check.py | 14 ++++---------- settings/templatetags/template_filters.py | 6 ++++-- static/custom_js/main.js | 4 ++-- .../includes/exposition/exposition_object.html | 1 - templates/client/includes/exposition/price.html | 16 ++++++++-------- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/functions/form_check.py b/functions/form_check.py index cfbe998f..19b93f86 100644 --- a/functions/form_check.py +++ b/functions/form_check.py @@ -15,12 +15,9 @@ def is_positive_integer(data, else: raise ValidationError(msg) - -from slugify import slugify - +from django.utils.encoding import smart_str, smart_unicode +import unicodedata def translit_with_separator(string, separator='-'): - - #return slugify(string) """ Trsanslit string and replace "bad" symbols for separator @@ -30,15 +27,13 @@ def translit_with_separator(string, separator='-'): #make string unicode string = string.strip() - string = u'%s'%string + string = smart_unicode(string) #make string translit try: st = pytils.translit.translify(string) except ValueError: - # remove exception symbs(hack) - string = string.replace(u'\u200e', '') - string = string.replace(u'\u200b', '') + string = unicodedata.normalize('NFKD', string).encode('ascii','ignore') st = pytils.translit.translify(string) #replace "bad" symbols for '-'symbol @@ -54,7 +49,6 @@ def translit_with_separator(string, separator='-'): return st.lower() - def is_latin_char(uchr): latin_letters= {} try: return latin_letters[uchr] diff --git a/settings/templatetags/template_filters.py b/settings/templatetags/template_filters.py index fb26e631..7f1fbb7a 100644 --- a/settings/templatetags/template_filters.py +++ b/settings/templatetags/template_filters.py @@ -141,8 +141,10 @@ def timesince_exp(value, date=None): """ delta = timedelta(days=28) d = date -value - if d>delta: - return True + + if d > delta: + if date.month== value.month: + return True return False @register.filter diff --git a/static/custom_js/main.js b/static/custom_js/main.js index 7f2f0d3b..3fde29bd 100644 --- a/static/custom_js/main.js +++ b/static/custom_js/main.js @@ -88,7 +88,8 @@ function postTimetable(data, textStatus){ function postStat(data, textStatus){ if(data.success){ - location.reload; + + window.location.reload(); } else{ $.each(data.errors, function(field_name, errors){ @@ -424,7 +425,6 @@ $(document).ready(function(){ $('#stat_form').on('submit', function(e){//submit(function(){ e.preventDefault(); var url = '/admin/ajax_post_stat/' + $('#obj_id').val() + '/'; - console.log(url) var formData = $(this).serialize(); $.ajax({ diff --git a/templates/client/includes/exposition/exposition_object.html b/templates/client/includes/exposition/exposition_object.html index 53552c55..48034fe6 100644 --- a/templates/client/includes/exposition/exposition_object.html +++ b/templates/client/includes/exposition/exposition_object.html @@ -73,7 +73,6 @@ -\1 {% endif %}
diff --git a/templates/client/includes/exposition/price.html b/templates/client/includes/exposition/price.html index f2470f8b..fd040251 100644 --- a/templates/client/includes/exposition/price.html +++ b/templates/client/includes/exposition/price.html @@ -129,7 +129,7 @@
  • {{ exposition.price_day_bar }} {% if exposition.price_day_bar|isdigit %}{{ exposition.get_currency_html }}{% endif %}
    -
    на 1 день
    +
    {% trans 'на 1 день' %}
  • {% endif %} {% if exposition.price_all_bar %} @@ -177,14 +177,14 @@
    {% trans 'Стоимость аренды 1м²' %}
    - {% if exposition.max_closed_equipped_area or exposition.max_closed_area or exposition.max_open_area %} + {% if exposition.max_closed_equipped_area or exposition.max_closed_area or exposition.max_open_area or exposition.min_closed_area %}