Django template tags: set .active on the first element of a forloop that satisfies a condition [duplicate]
问题 This question already has answers here : ForLoop Iterations as List Index in Django Template (3 answers) Closed 5 years ago . I have the following problem: A user is taking a course on my website. A course consists of several chapters and each chapter consists of several steps. If the user is logged in and completes a step, the backend saves the progress. When the user comes back to the site, I want him to continue where he left off. To do this I have to add the css class "active" to the