Modify atom change feed so that
1. It returns the last 14 days of changes rather than the last 20 2. Change the atom template so that it has correct time offsets rather than saying that PST and UTC are the same 3. Change the atom template so that it uses content rather than summary and return HTML content with line breaks as needed. - Legacy-Id: 5425
This commit is contained in:
parent
2c810112ab
commit
cb1593d6a2
|
@ -2,6 +2,7 @@ import csv
|
|||
import uuid
|
||||
import datetime
|
||||
import hashlib
|
||||
from datetime import timedelta
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import REDIRECT_FIELD_NAME
|
||||
|
@ -137,7 +138,9 @@ def view_group_list(request, acronym):
|
|||
|
||||
def _atom_view(request, clist, significant=False):
|
||||
documents = [i['pk'] for i in clist.get_documents().values('pk')]
|
||||
notifications = DocEvent.objects.filter(doc__pk__in=documents)\
|
||||
startDate = datetime.datetime.now() - datetime.timedelta(days=14)
|
||||
|
||||
notifications = DocEvent.objects.filter(doc__pk__in=documents, time__gte=startDate)\
|
||||
.distinct()\
|
||||
.order_by('-time', '-id')
|
||||
if significant:
|
||||
|
@ -154,7 +157,7 @@ def _atom_view(request, clist, significant=False):
|
|||
|
||||
return render_to_response('community/public/atom.xml',
|
||||
{'cl': clist,
|
||||
'entries': notifications[:20],
|
||||
'entries': notifications,
|
||||
'title': title,
|
||||
'subtitle': subtitle,
|
||||
'id': feed_id.get_urn(),
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<title type="text">{{ title }}</title>
|
||||
<subtitle type="text">{{ subtitle }}</subtitle>
|
||||
<id>{{ id }}</id>
|
||||
<updated>{{ updated|date:"Y-m-d\TH:i:s" }}Z</updated>
|
||||
<updated>{{ updated|date:"Y-m-d\TH:i:sO" }}</updated>
|
||||
<link rel="alternate" type="text/html" hreflang="en" href="http://{{ request.get_host }}/"/>
|
||||
<link rel="self" type="application/atom+xml" href="http://{{ request.get_host }}{{ request.get_full_path }}"/>
|
||||
|
||||
|
@ -15,16 +15,16 @@
|
|||
|
||||
<id>{{ entry.id }}</id>
|
||||
|
||||
<updated>{{ entry.time|date:"Y-m-d\TH:i:s" }}Z</updated>
|
||||
<updated>{{ entry.time|date:"Y-m-d\TH:i:sO" }}</updated>
|
||||
|
||||
<published>{{ entry.time|date:"Y-m-d\TH:i:s" }}</published>
|
||||
<published>{{ entry.time|date:"Y-m-d\TH:i:sO" }}</published>
|
||||
|
||||
<author>
|
||||
<name>{{ entry.by }}</name>
|
||||
</author>
|
||||
|
||||
<summary>{{ entry.desc|striptags }}</summary>
|
||||
|
||||
{%autoescape off %}
|
||||
<content type="html">{{ entry.desc|linebreaksbr|force_escape }}</content>
|
||||
{%endautoescape %}
|
||||
</entry>
|
||||
{% endfor %}
|
||||
|
||||
|
|
Loading…
Reference in a new issue