Merge lp:~mhall119/loco-team-portal/team-events-rss into lp:loco-team-portal

Proposed by Michael Hall
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mhall119/loco-team-portal/team-events-rss
Merge into: lp:loco-team-portal
Prerequisite: lp:~mhall119/loco-team-portal/fix-509675-and-add-team-event
Diff against target: 108 lines (+51/-0)
5 files modified
loco_directory/events/urls.py (+1/-0)
loco_directory/events/views.py (+24/-0)
loco_directory/templates/events/team_events_rss.xml (+17/-0)
loco_directory/templates/teams/team_detail.html (+5/-0)
loco_directory/templates/teams/team_event_list.html (+4/-0)
To merge this branch: bzr merge lp:~mhall119/loco-team-portal/team-events-rss
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Approve
Review via email: mp+17759@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Hall (mhall119) wrote :

Adds RSS links and feeds for Team Events

Revision history for this message
Daniel Holbach (dholbach) wrote :

It'd be nice to have the name, description and datetimes in the text of the rss entry somehow. Apart from that: great work.

Revision history for this message
Daniel Holbach (dholbach) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/events/urls.py'
2--- loco_directory/events/urls.py 2010-01-20 17:03:16 +0000
3+++ loco_directory/events/urls.py 2010-01-20 17:03:16 +0000
4@@ -13,6 +13,7 @@
5 url(r'^team/(?P<team_event_id>\d+)/comment/$', 'events.views.team_event_comment_new', name='team-event-comment-new'),
6 url(r'^team/(?P<team_slug>[a-zA-Z0-9\-\.\+?]+)/add/$', 'events.views.team_event_new', name='team-event-new'),
7 url(r'^team/add/$', 'events.views.team_event_select', name='team-event-select'),
8+ url(r'^team/(?P<team_slug>[a-zA-Z0-9\-\.\+?]+)/rss/$', 'events.views.team_events_rss', name='team-events-rss'),
9 #global events
10 url(r'^global/ical/$', 'events.views.global_event_list_ical', name='global-event-list-ical'),
11 url(r'^global/(?P<global_event_id>\d+)/detail/$', 'events.views.global_event_detail', name='global-event-detail'),
12
13=== modified file 'loco_directory/events/views.py'
14--- loco_directory/events/views.py 2010-01-20 17:03:16 +0000
15+++ loco_directory/events/views.py 2010-01-20 17:03:16 +0000
16@@ -18,6 +18,8 @@
17
18 from common import launchpad
19
20+import datetime
21+
22 def event_list(request):
23 """
24 a list with all events (teamevents and globalevents)
25@@ -138,6 +140,28 @@
26 context = {'teams': teams}
27 return render_to_response('events/team_event_new_select.html', context, RequestContext(request))
28
29+def team_events_rss(request, team_slug):
30+ team_object = get_object_or_404(Team, lp_name=team_slug)
31+ events = TeamEvent.objects.filter(date_end__gt=datetime.datetime.now()).order_by('date_begin')[:15]
32+
33+ if request.META.has_key('wsgi.url_scheme'):
34+ scheme = request.META.get('wsgi.url_scheme')
35+ else:
36+ scheme = 'http'
37+
38+ if request.META.has_key('HTTP_HOST'):
39+ host = request.META.get('HTTP_HOST')
40+ else:
41+ host = request.META.get('SERVER_NAME')
42+
43+ if request.META.get('SERVER_PORT', 80) == 80:
44+ base = '%s://%s' % (scheme, host)
45+ else:
46+ base = '%s://%s:%s' % (scheme, host, request.META.get('SERVER_PORT', 80))
47+
48+ context = {'team_object': team_object, 'events': events, 'base':base}
49+ return render_to_response('events/team_events_rss.xml', context, RequestContext(request), mimetype='application/xhtml+xml')
50+
51 @login_required
52 def team_event_new(request, team_slug):
53 """
54
55=== added file 'loco_directory/templates/events/team_events_rss.xml'
56--- loco_directory/templates/events/team_events_rss.xml 1970-01-01 00:00:00 +0000
57+++ loco_directory/templates/events/team_events_rss.xml 2010-01-20 17:03:16 +0000
58@@ -0,0 +1,17 @@
59+<?xml version="1.0" encoding="UTF-8"?>
60+{% load i18n %}
61+<rss version="2.0">
62+ <channel>
63+ <title>{% blocktrans with team_object.name as team_name %}Upcoming Events for {{team_name}}{% endblocktrans %}</title>
64+ <link>{{base}}{% url team-event-list team_object.lp_name %}</link>
65+
66+ {% for e in events %}
67+ <item>
68+ <title> {{ e.name }}</title>
69+ <link>{{base}}{% url team-event-detail e.id %}</link>
70+ <description>{{ e.description }}</description>
71+ <guid>{{base}}{% url team-event-detail e.id %}</guid>
72+ </item>
73+ {% endfor %}
74+ </channel>
75+</rss>
76\ No newline at end of file
77
78=== modified file 'loco_directory/templates/teams/team_detail.html'
79--- loco_directory/templates/teams/team_detail.html 2010-01-09 13:58:29 +0000
80+++ loco_directory/templates/teams/team_detail.html 2010-01-20 17:03:16 +0000
81@@ -3,7 +3,12 @@
82
83 {% block title %}{% trans team.name %}{% endblock %}
84
85+{% block extrahead %}
86+<link type="application/rss+xml" rel="alternate" title="Team Events (RSS)" href="{% url team-events-rss team.lp_name %}" />
87+{% endblock %}
88+
89 {% block content %}
90+
91 <div class="team_detail">
92 <div id="team">
93 <!--Visual 3D box-->
94
95=== modified file 'loco_directory/templates/teams/team_event_list.html'
96--- loco_directory/templates/teams/team_event_list.html 2009-12-26 10:00:19 +0000
97+++ loco_directory/templates/teams/team_event_list.html 2010-01-20 17:03:16 +0000
98@@ -3,6 +3,10 @@
99
100 {% block title %}{% blocktrans with team_object.lp_name as teamname %}{{teamname}} Events List{% endblocktrans %}{% endblock %}
101
102+{% block extrahead %}
103+<link type="application/rss+xml" rel="alternate" title="Team Events (RSS)" href="{% url team-events-rss team_object.lp_name %}" />
104+{% endblock %}
105+
106 {% block content %}
107 <div class="mainpage">
108 <h1>{% blocktrans with team_object.lp_name as teamname %}{{teamname}} Events List{% endblocktrans %}</h1>

Subscribers

People subscribed via source and target branches