[Fixed]-Django, can't make options selected

1πŸ‘

βœ…

In views.py you are passing grade

data['grade'] = Score.objects.filter(granted_by=request.user)

But in vote.html, you are iterating with grades

<option value="{{ value.0 }}" {% for a in grades %} {% if a.grade == value.0 %}selected{% endif %} {% endfor %} >{{ value.0 }}</option>

Either change grade as grades in views.py or change grades as grade in vote.html

Leave a comment