Skip to content

Commit 9564a05

Browse files
author
sparkle-sparkle
committed
ValueError at /add_contest/ #148
* make date input fields required * define date pattern matching the pattern in the placeholder
1 parent 2a0e5fd commit 9564a05

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

oshc/main/templates/contest_edit.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
<div class="form-group">
2222
<label for="start_date" class="control-label col-xs-2">Start Date:</label>
2323
<div class="col-xs-3">
24-
<input type="start_date" class="form-control" id="start_date" name="start_date" placeholder="YYYY-MM-DD">
24+
<input type="start_date" class="form-control" id="start_date" name="start_date" placeholder="YYYY-MM-DD" pattern="(?:20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))" required>
2525
</div>
2626
</div>
2727

2828
<div class="form-group">
2929
<label for="end_date" class="control-label col-xs-2">End Date:</label>
3030
<div class="col-xs-3">
31-
<input type="end_date" class="form-control" id="end_date" name="end_date" placeholder="YYYY-MM-DD">
31+
<input type="end_date" class="form-control" id="end_date" name="end_date" placeholder="YYYY-MM-DD" pattern="(?:20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))" required>
3232
</div>
3333
</div>
3434

@@ -47,4 +47,4 @@
4747

4848
</form>
4949

50-
{% endblock %}
50+
{% endblock %}

0 commit comments

Comments
 (0)