Commit b7cfbe0c by Don Mitchell

Add safety check for start dates unbound

parent d7194e6b
...@@ -37,13 +37,13 @@ ...@@ -37,13 +37,13 @@
<div class="field field-start-date"> <div class="field field-start-date">
<label for="start_date">Release Day</label> <label for="start_date">Release Day</label>
<input type="text" id="start_date" name="start_date" <input type="text" id="start_date" name="start_date"
value="${subsection.lms.start.strftime('%m/%d/%Y')}" value="${subsection.lms.start.strftime('%m/%d/%Y') if subsection.lms.start else ''}"
placeholder="MM/DD/YYYY" class="date" size='15' autocomplete="off"/> placeholder="MM/DD/YYYY" class="date" size='15' autocomplete="off"/>
</div> </div>
<div class="field field-start-time"> <div class="field field-start-time">
<label for="start_time">Release Time (<abbr title="Coordinated Universal Time">UTC</abbr>)</label> <label for="start_time">Release Time (<abbr title="Coordinated Universal Time">UTC</abbr>)</label>
<input type="text" id="start_time" name="start_time" <input type="text" id="start_time" name="start_time"
value="${subsection.lms.start.strftime('%H:%M')}" value="${subsection.lms.start.strftime('%H:%M') if subsection.lms.start else ''}"
placeholder="HH:MM" class="time" size='10' autocomplete="off"/> placeholder="HH:MM" class="time" size='10' autocomplete="off"/>
</div> </div>
</div> </div>
......
...@@ -154,8 +154,12 @@ ...@@ -154,8 +154,12 @@
<h3 class="section-name" data-name="${section.display_name_with_default | h}"></h3> <h3 class="section-name" data-name="${section.display_name_with_default | h}"></h3>
<div class="section-published-date"> <div class="section-published-date">
<% <%
start_date_str = section.lms.start.strftime('%m/%d/%Y') if section.lms.start is not None:
start_time_str = section.lms.start.strftime('%H:%M') start_date_str = section.lms.start.strftime('%m/%d/%Y')
start_time_str = section.lms.start.strftime('%H:%M')
else:
start_date_str = ''
start_time_str = ''
%> %>
%if section.lms.start is None: %if section.lms.start is None:
<span class="published-status">This section has not been released.</span> <span class="published-status">This section has not been released.</span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment