Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: mozilla/kuma
...
head fork: mozilla/kuma
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
View
12 apps/devmo/helpers.py
@@ -42,6 +42,18 @@ def isotime(t):
return _append_tz(t).astimezone(pytz.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
+@register.filter
+def datetimeformat(value,
+ out_format='%Y-%m-%d',
+ in_format='%Y-%m-%dT%H:%M:%S'):
+ if isinstance(value, unicode):
+ try:
+ value = datetime.datetime.strptime(value, in_format)
+ except:
+ pass
+ return value.strftime(out_format)
+
+
def _append_tz(t):
tz = pytz.timezone(settings.TIME_ZONE)
return tz.localize(t)
View
9 apps/devmo/tests/test_helpers.py
@@ -2,7 +2,7 @@
import test_utils
from soapbox.models import Message
-from devmo.helpers import urlencode, get_soapbox_messages
+from devmo.helpers import urlencode, get_soapbox_messages, datetimeformat
class TestUrlEncode(test_utils.TestCase):
@@ -17,6 +17,13 @@ def test_utf8_urlencode(self):
ok_(False, "There should be no KeyError")
+class TestDateTimeFormat(test_utils.TestCase):
+
+ def test_utf8_urlencode(self):
+ s = u"2013-05-20T15:06:45"
+ eq_('2013-05-20', datetimeformat(s))
+
+
class TestSoapbox(test_utils.TestCase):
def test_global_message(self):
View
3  apps/search/templates/search/results.html
@@ -7,6 +7,9 @@
<li class="doc-result">
{% set url = '%s%s' % (settings.SITE_URL, url('wiki.document', doc.slug, locale=doc.locale)) %}
<h3><a href="{{ url }}">{{ doc.title }}</a></h3>
+ <div class="searchDate">
+ {{ doc.modified|datetimeformat }}
+ </div>
<div class="searchHighlight">
{{ doc.get_excerpt()|safe }}
</div>
View
2  apps/wiki/models.py
@@ -1537,6 +1537,7 @@ def extract_document(cls, obj_id, obj=None):
'title': obj.title,
'slug': obj.slug,
'locale': obj.locale,
+ 'modified': obj.modified,
'content': strip_tags(obj.rendered_html)
}
@@ -1547,6 +1548,7 @@ def get_mapping(cls):
'title': {'type': 'string'},
'slug': {'type': 'string'},
'locale': {'type': 'string', 'index': 'not_analyzed'},
+ 'modified': {'type': 'date'},
'content': {'type': 'string', 'analyzer': 'wikiMarkup'}
}

No commit comments for this range

Something went wrong with that request. Please try again.