Show error message when start and finish date is invalid
This commit is contained in:
@ -13,7 +13,51 @@ Add read dates for "<em>{{ title }}</em>"
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
{% include 'readthrough/readthrough_form.html' with readthrough=None %}
|
||||
{% csrf_token %}
|
||||
|
||||
<input type="hidden" name="id" value="{{ readthrough.id }}">
|
||||
<input type="hidden" name="book" value="{{ book.id }}">
|
||||
<input type="hidden" name="user" value="{{ request.user.id }}">
|
||||
<div class="field">
|
||||
<label class="label" tabindex="0" id="add_readthrough_focus_{{ readthrough.id }}" for="id_start_date_{{ readthrough.id }}">
|
||||
{% trans "Started reading" %}
|
||||
</label>
|
||||
{% firstof form.start_date.value readthrough.start_date|date:"Y-m-d" as value %}
|
||||
<input
|
||||
type="date"
|
||||
name="start_date"
|
||||
class="input"
|
||||
id="id_start_date_{{ readthrough.id }}"
|
||||
value="{{ value }}"
|
||||
aria-describedby="desc_start_date"
|
||||
>
|
||||
{% include 'snippets/form_errors.html' with errors_list=form.start_date.errors id="desc_start_date" %}
|
||||
</div>
|
||||
|
||||
{# Only show progress for editing existing readthroughs #}
|
||||
{% if readthrough.id and not readthrough.finish_date %}
|
||||
{% join "id_progress" readthrough.id as field_id %}
|
||||
<label class="label" for="{{ field_id }}">
|
||||
{% trans "Progress" %}
|
||||
</label>
|
||||
{% include "snippets/progress_field.html" with id=field_id %}
|
||||
{% endif %}
|
||||
|
||||
<div class="field">
|
||||
<label class="label" for="id_finish_date_{{ readthrough.id }}">
|
||||
{% trans "Finished reading" %}
|
||||
</label>
|
||||
{% firstof form.finish_date.value readthrough.finish_date|date:"Y-m-d" as value %}
|
||||
<input
|
||||
type="date"
|
||||
name="finish_date"
|
||||
class="input"
|
||||
id="id_finish_date_{{ readthrough.id }}"
|
||||
value="{{ value }}"
|
||||
aria-describedby="desc_finish_date"
|
||||
>
|
||||
{% include 'snippets/form_errors.html' with errors_list=form.finish_date.errors id="desc_finish_date" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
|
Reference in New Issue
Block a user