Fix template path for question review block and remove unnecessary form wrapper to prevent nested forms
This commit is contained in:
+1
-1
@@ -3007,7 +3007,7 @@ class GenericViewBase:
|
|||||||
|
|
||||||
# Default: render the block (latest if exists, otherwise form)
|
# Default: render the block (latest if exists, otherwise form)
|
||||||
if latest:
|
if latest:
|
||||||
return render(request, "/generic/partials/question_review_block.html", {"review": latest, "question": question, "app_name": self.app_name})
|
return render(request, "generic/partials/question_review_block.html", {"review": latest, "question": question, "app_name": self.app_name})
|
||||||
else:
|
else:
|
||||||
# Ensure a form is available for the template
|
# Ensure a form is available for the template
|
||||||
if latest:
|
if latest:
|
||||||
|
|||||||
@@ -114,8 +114,12 @@
|
|||||||
|
|
||||||
{% comment %} <span class="btn btn-sm btn-outline-success" data-bs-toggle="modal" data-bs-target="#reviewModal" hx-get="{% url 'sbas:question_set_review' question.pk %}?edit=1&new=1" hx-target="#review-form" hx-swap="innerHTML" hx-trigger="load">Add Review</button> {% endcomment %}
|
{% comment %} <span class="btn btn-sm btn-outline-success" data-bs-toggle="modal" data-bs-target="#reviewModal" hx-get="{% url 'sbas:question_set_review' question.pk %}?edit=1&new=1" hx-target="#review-form" hx-swap="innerHTML" hx-trigger="load">Add Review</button> {% endcomment %}
|
||||||
|
|
||||||
<form id="review-form">
|
{% comment %} The included partial contains its own <form> with hx-post. Do not wrap it in another form (nested forms break submission). {% endcomment %}
|
||||||
{% include 'generic/partials/question_review_form.html' with app_name='sbas' question=question form=form %}
|
{% include 'generic/partials/question_review_form.html' with app_name='sbas' question=question form=form %}
|
||||||
</form>
|
|
||||||
|
<div id="question-review-block" class="mt-4">
|
||||||
|
{# Placeholder while HTMX fetches review/block #}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user