SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 9b5e129c authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add first RSS feed for latest comments

parent cc703cff
No related branches found
No related tags found
No related merge requests found
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from comments.models import Comment
class LatestCommentFeed(Feed):
title = "SciPost Latest Comments"
link = "/"
def items(self):
return Comment.objects.filter(status__gte=0).order_by('-date_submitted')[:5]
def item_title(self, item):
return item.comment_text[:50]
# def item_description(self, item):
# return item.description
def item_link(self, item):
if item.commentary:
return reverse('commentaries:commentary', kwargs={'arxiv_or_DOI_string': item.commentary.arxiv_or_DOI_string})
elif item.submission:
return reverse('submissions:submission', kwargs={'submission_id': item.submission.id})
elif item.thesislink:
return reverse('theses:thesis', kwargs={'thesislink_id': item.thesislink.id})
else:
return reverse('scipost:index')
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<hr class="hr12"/> <hr class="hr12"/>
<section> <section>
<div class="flex-greybox"> <div class="flex-greybox">
<h2>Invitations sent (response pending):</h2> <h2>Invitations sent (response pending) &nbsp;&nbsp; EF ({{ nr_sent_reg_inv_fellows }}), C ({{ nr_sent_reg_inv_contrib }}):</h2>
</div> </div>
<hr class="hr6"/> <hr class="hr6"/>
<h3>Editorial Fellows ({{ nr_sent_reg_inv_fellows }})</h3> <h3>Editorial Fellows ({{ nr_sent_reg_inv_fellows }})</h3>
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<hr class="hr12"/> <hr class="hr12"/>
<section> <section>
<div class="flex-greybox"> <div class="flex-greybox">
<h2>Invitations sent (responded):</h2> <h2>Invitations sent (responded) &nbsp;&nbsp; EF ({{ nr_resp_reg_inv_fellows }}), C ({{ nr_resp_reg_inv_contrib }}):</h2>
</div> </div>
<hr class="hr6"/> <hr class="hr6"/>
<h3>Editorial Fellows ({{ nr_resp_reg_inv_fellows }})</h3> <h3>Editorial Fellows ({{ nr_resp_reg_inv_fellows }})</h3>
......
...@@ -2,6 +2,7 @@ from django.conf.urls import include, patterns, url ...@@ -2,6 +2,7 @@ from django.conf.urls import include, patterns, url
from django.views.generic import TemplateView from django.views.generic import TemplateView
from . import views from . import views
from .feeds import LatestCommentFeed
urlpatterns = [ urlpatterns = [
url(r'^$', views.index, name='index'), url(r'^$', views.index, name='index'),
...@@ -56,4 +57,7 @@ urlpatterns = [ ...@@ -56,4 +57,7 @@ urlpatterns = [
url(r'^claim_thesis_authorship/(?P<thesis_id>[0-9]+)/(?P<claim>[0-1])$', views.claim_thesis_authorship, name='claim_thesis_authorship'), url(r'^claim_thesis_authorship/(?P<thesis_id>[0-9]+)/(?P<claim>[0-1])$', views.claim_thesis_authorship, name='claim_thesis_authorship'),
url(r'^vet_authorship_claims$', views.vet_authorship_claims, name="vet_authorship_claims"), url(r'^vet_authorship_claims$', views.vet_authorship_claims, name="vet_authorship_claims"),
url(r'^vet_authorship_claim/(?P<claim_id>[0-9]+)/(?P<claim>[0-1])$', views.vet_authorship_claim, name='vet_authorship_claim'), url(r'^vet_authorship_claim/(?P<claim_id>[0-9]+)/(?P<claim>[0-1])$', views.vet_authorship_claim, name='vet_authorship_claim'),
# Feeds
url(r'^latest_comment/feed/$', LatestCommentFeed()),
] ]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment