Fix date display in unit page

This commit is contained in:
Calen Pennington
2012-10-12 15:16:44 -04:00
parent 4005cbf455
commit a160f6144f
3 changed files with 3 additions and 2 deletions

View File

@@ -77,5 +77,4 @@ def compute_unit_state(unit):
def get_date_display(date):
print date, type(date)
return date.strftime("%d %B, %Y at %I:%M %p")

View File

@@ -10,6 +10,7 @@ import sys
import time
import tarfile
import shutil
from datetime import datetime
from collections import defaultdict
from uuid import uuid4
from lxml import etree
@@ -287,6 +288,7 @@ def edit_unit(request, location):
'draft_preview_link': preview_lms_link,
'published_preview_link': lms_link,
'subsection': containing_subsection,
'release_date': get_date_display(datetime.fromtimestamp(time.mktime(containing_subsection.start))),
'section': containing_section,
'create_new_unit_template': Location('i4x', 'edx', 'templates', 'vertical', 'Empty'),
'unit_state': unit_state,

View File

@@ -85,7 +85,7 @@
<p class="publish-draft-message">This is a draft of the published unit. To update the live version, you must <a href="#" id="publish-draft">replace it with this draft</a>.</p>
</div>
<div class="row status">
<p>This unit is scheduled to be released to <strong>students</strong> on <strong>${subsection.start}</strong> with the subsection <a href="${reverse('edit_subsection', kwargs={'location': subsection.location})}">"${subsection.display_name}"</a></p>
<p>This unit is scheduled to be released to <strong>students</strong> on <strong>${release_date}</strong> with the subsection <a href="${reverse('edit_subsection', kwargs={'location': subsection.location})}">"${subsection.display_name}"</a></p>
</div>
<div class="row unit-actions">
<a id="save-draft" href="#" class="save-button">Save Draft</a>