Answer the question
In order to leave comments, you need to log in
How to implement the rendering of the "stars" of the rating?
Good afternoon,
I have such stars, you can add a class to them, and they will be "empty".
Through python, I need to implement the rendering of these stars according to the rating. (Let's say if the rate is 3, then 3 stars are on)
how can this be done?
html code:
<div class="course-box_rating">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
Answer the question
In order to leave comments, you need to log in
Well, if you need it directly through Python, then I’m afraid there won’t be enough bukaf to describe how to do it, but if you think a little and remember that you have JS on the client, then the questions will disappear by themselves, or, directly in the template through cycles, pass context, type
context = {
...
"stars": 5,
"rating": 3,
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question