diff --git a/scipost/feeds.py b/scipost/feeds.py new file mode 100644 index 0000000000000000000000000000000000000000..fc905841d4b711cbe1fdea729421c47e2187cdfa --- /dev/null +++ b/scipost/feeds.py @@ -0,0 +1,27 @@ +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') diff --git a/scipost/templates/scipost/registration_invitations.html b/scipost/templates/scipost/registration_invitations.html index b3ba15a6f6dc9083675c3e024ba644919abf62d8..464a4f553c3115f23730a269daec32ade4fbce6f 100644 --- a/scipost/templates/scipost/registration_invitations.html +++ b/scipost/templates/scipost/registration_invitations.html @@ -26,7 +26,7 @@ <hr class="hr12"/> <section> <div class="flex-greybox"> - <h2>Invitations sent (response pending):</h2> + <h2>Invitations sent (response pending) EF ({{ nr_sent_reg_inv_fellows }}), C ({{ nr_sent_reg_inv_contrib }}):</h2> </div> <hr class="hr6"/> <h3>Editorial Fellows ({{ nr_sent_reg_inv_fellows }})</h3> @@ -62,7 +62,7 @@ <hr class="hr12"/> <section> <div class="flex-greybox"> - <h2>Invitations sent (responded):</h2> + <h2>Invitations sent (responded) EF ({{ nr_resp_reg_inv_fellows }}), C ({{ nr_resp_reg_inv_contrib }}):</h2> </div> <hr class="hr6"/> <h3>Editorial Fellows ({{ nr_resp_reg_inv_fellows }})</h3> diff --git a/scipost/urls.py b/scipost/urls.py index cb7294f370b7f8e7553b9fee5c27c07427862f44..adcc02176a004b8b1729fb3131156adf6f5687f0 100644 --- a/scipost/urls.py +++ b/scipost/urls.py @@ -2,6 +2,7 @@ from django.conf.urls import include, patterns, url from django.views.generic import TemplateView from . import views +from .feeds import LatestCommentFeed urlpatterns = [ url(r'^$', views.index, name='index'), @@ -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'^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'), + + # Feeds + url(r'^latest_comment/feed/$', LatestCommentFeed()), ]