Skip to content

Commit d1cb4e6

Browse files
committed
Fix template condition
1 parent 816a794 commit d1cb4e6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

templates/partials/book_form.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@
44
<form method="POST">
55
{% csrf_token %}
66
{{ form|crispy }}
7-
<button type="submit" hx-post="."
7+
{% if book %}
8+
<button type="submit" hx-post="{% url 'update-book' book.id %}"
89
class="inline-flex items-center px-3 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
910
Submit
1011
</button>
11-
{% if book %}
1212
<button hx-get="{% url 'detail-book' book.id %}" type="button"
1313
class="ml-2 inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
1414
Cancel
1515
</button>
16+
{% else %}
17+
<button type="submit" hx-post="."
18+
class="inline-flex items-center px-3 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
19+
Submit
20+
</button>
1621
{% endif %}
1722
</form>
1823
</div>

0 commit comments

Comments
 (0)