# Замена словаря в шаблоне
def master_promo_count_day(self):
if self.master_promo_count == 1:
return f'день'
elif self.master_promo_count == 2:
return f'дня'
else:
return f'дней'
def master_promo_count_day(self, *args, **kwargs):
if self.promo(self, *args, **kwargs) == 1:
return f'день'
elif self.promo(self, *args, **kwargs) == 2:
return f'дня'
else:
return f'дней'
class MastersView(ListView): # Страница поиска мастеров
model = NewMaster
queryset = NewMaster.objects.all()
template_name = "catalog/all - masters - page.html"
paginate_by = 30
master_promo_discount = models.IntegerField()
{% if post.article_razdel == "ПАРИКМАХЕРСКАЯ" %}
<div class="blog-subtitle"><a style="color: red; font-size: 13px;" href="{% url 'blog_haircut' %}">{{ post.article_razdel }}</a></div>
{% elif post.article_razdel == "КОСМЕТОЛОГИЯ" %}
<div class="blog-subtitle"><a style="color: red; font-size: 13px;" href="{% url 'blog_cosmetologia' %}">{{ post.article_razdel }}</a></div>