Шаблоны Django Не удалось разобрать остаток
У меня есть этот шаблон, я перебираю все варианты в вопросе, и я хочу по умолчанию проверить вопрос, который пользователь выбрал ранее. переменная selected_choice приходит из моего представления, и я получил ее нормально в моем шаблоне.
{% extends 'base.html' %}
{% block content %}
<div id="detail" class="">
<form hx-post="{% url 'main:vote' question.id %}" hx-trigger="submit" hx-target="#detail" hx-swap="outerHTML">
{% csrf_token %}
<fieldset>
<legend><h1>{{ question.question_text }}</h1></legend>
{% if error_message %}<p>
<strong>{{ error_message }}</strong>
</p>
{% endif %}
{% for choice in question.choices.all %}
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}" {% if selected_choice and choice.id==selected_choice %}checked{% endif %}>
<label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br>
{% endfor %}
</fieldset>
<button type="submit">Submit</button>
</form>
</div>
{% endblock content %}
Я получаю эту ошибку
Could not parse the remainder: '==selected_choice' from 'choice.id==selected_choice'