diff --git a/frontend/html/users/profile.html b/frontend/html/users/profile.html index 35adba635..bdc841016 100644 --- a/frontend/html/users/profile.html +++ b/frontend/html/users/profile.html @@ -53,14 +53,14 @@ {% if user.membership_days_left < 150 %} - {% if user.membership_days_left < 10 %}😱{% else %}😋{% endif %} {{ user.membership_days_left | cool_number }} - {{ user.membership_days_left | rupluralize:"день,дня,дней" }} + {% if user.membership_days_left < 10 %}😱{% else %}😋{% endif %} {{ user.membership_days_left | ceil | cool_number }} + {{ user.membership_days_left | ceil | rupluralize:"день,дня,дней" }} {% elif user.membership_days_left < 700 %} - 😎 {{ user.membership_months_left | cool_number }} - {{ user.membership_months_left | rupluralize:"месяц,месяца,месяцев" }} + 😎 {{ user.membership_months_left | ceil | cool_number }} + {{ user.membership_months_left | ceil | rupluralize:"месяц,месяца,месяцев" }} {% else %} - 💎 {{ user.membership_years_left | cool_number }} - {{ user.membership_years_left | rupluralize:"год,года,лет" }} + 💎 {{ user.membership_years_left | ceil | cool_number }} + {{ user.membership_years_left | ceil | rupluralize:"год,года,лет" }} {% endif %} diff --git a/posts/templatetags/text_filters.py b/posts/templatetags/text_filters.py index 6789a5b74..6d51a6a81 100755 --- a/posts/templatetags/text_filters.py +++ b/posts/templatetags/text_filters.py @@ -1,4 +1,5 @@ import json +import math from datetime import datetime, timedelta from django import template @@ -28,6 +29,11 @@ def markdown(text): return mark_safe(markdown_text(text)) +@register.filter +def ceil(value): + return math.ceil(value or 0) + + @register.filter def cool_number(value, num_decimals=1): """