Skip to content
Snippets Groups Projects
Commit 4c3fa2b5 authored by Brian Moe's avatar Brian Moe
Browse files

RSS feeds no longer show Test events unless explicitly requested

parent 2bc67ce3
No related branches found
No related tags found
No related merge requests found
...@@ -8,16 +8,21 @@ from django.template import RequestContext ...@@ -8,16 +8,21 @@ from django.template import RequestContext
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from models import Event, Group from models import Event, Group
from views import view, search from views import view, search, index
class EventFeed(Feed): class EventFeed(Feed):
def get_object(self, bits): def get_object(self, bits):
# [] , ['cbc'], ['cbc','lowmass'] # [] , ['cbc'], ['cbc','lowmass']
objs = Event.objects.order_by("-id")
if 'test' not in bits:
# Filter out test group
testGroup = Group.objects.filter(name__iexact='Test')
if testGroup.count():
objs = objs.exclude(group=testGroup[0])
if len(bits) not in [0,1,2]: if len(bits) not in [0,1,2]:
raise FeedDoesNotExist raise FeedDoesNotExist
if not bits: if not bits:
title = "GraCEDB Events" title = "GraCEDb Events"
objs = Event.objects.order_by("-id")
else: else:
group = Group.objects.filter(name__iexact=bits[0]) group = Group.objects.filter(name__iexact=bits[0])
if not group.count(): if not group.count():
...@@ -25,7 +30,7 @@ class EventFeed(Feed): ...@@ -25,7 +30,7 @@ class EventFeed(Feed):
group = group[0] group = group[0]
objs = Event.objects.filter(group=group) objs = Event.objects.filter(group=group)
if len(bits) == 1: if len(bits) == 1:
title = "GraCEDB Events for %s Group" % group.name title = "GraCEDb %s Events" % group.name
else: else:
requestedtype = bits[1] requestedtype = bits[1]
type = [(c,t) for (c,t) in Event.ANALYSIS_TYPE_CHOICES \ type = [(c,t) for (c,t) in Event.ANALYSIS_TYPE_CHOICES \
...@@ -33,7 +38,7 @@ class EventFeed(Feed): ...@@ -33,7 +38,7 @@ class EventFeed(Feed):
if not type: if not type:
raise FeedDoesNotExist raise FeedDoesNotExist
typecode, type = type[0] typecode, type = type[0]
title = "GraCEDB Events for %s / %s" % (group.name, type) title = "GraCEDb %s / %s Events" % (group.name, type)
objs = objs.filter(analysisType=typecode) objs = objs.filter(analysisType=typecode)
return title, objs[:10] return title, objs[:10]
...@@ -43,7 +48,7 @@ class EventFeed(Feed): ...@@ -43,7 +48,7 @@ class EventFeed(Feed):
def link(self, obj): def link(self, obj):
# This is the link around the title for the entire feed. # This is the link around the title for the entire feed.
return reverse(search) return reverse("home")
def item_link(self, obj): def item_link(self, obj):
return reverse(view, args=[obj.graceid()]) return reverse(view, args=[obj.graceid()])
......
...@@ -4,7 +4,7 @@ from django.conf.urls.defaults import * ...@@ -4,7 +4,7 @@ from django.conf.urls.defaults import *
#import django.views.generic.list_detail #import django.views.generic.list_detail
urlpatterns = patterns('gracedb.gracedb.views', urlpatterns = patterns('gracedb.gracedb.views',
(r'^$', 'index'), url (r'^$', 'index', name="home"),
url (r'^create/$', 'create', name="create"), url (r'^create/$', 'create', name="create"),
url (r'^search/$', 'search', name="search"), url (r'^search/$', 'search', name="search"),
url (r'^view/(?P<graceid>[\w\d]+)', 'view', name="view"), url (r'^view/(?P<graceid>[\w\d]+)', 'view', name="view"),
......
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