A
A
Alexander2018-09-29 01:14:21
Django
Alexander, 2018-09-29 01:14:21

How to do validation in django?

Let's say we display products from the database, some products have is_sale=True, others have False. How to check True or False when outputting to html, or does it need to be done by views? If in PHP such a function is approximately implemented through

if($is_sale == True){
 <div>Sale</div>
}

Is it possible to do this in django?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
planc, 2018-09-29
@AleksandrB

https://docs.djangoproject.com/en/2.1/ref/template...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question