diff options
-rw-r--r-- | feeds.py | 12 | ||||
-rw-r--r-- | templates/timetable.html | 2 | ||||
-rw-r--r-- | urls.py | 1 |
3 files changed, 10 insertions, 5 deletions
@@ -14,6 +14,7 @@ # along with celcatsanitizer. If not, see <http://www.gnu.org/licenses/>. from django.core.exceptions import ObjectDoesNotExist +from django.conf import settings from django.contrib.syndication.views import Feed from django.db.models import Q from django.template import loader @@ -76,10 +77,7 @@ class IcalFeed(Feed): "location": format_rooms(item.rooms.all())} -class AtomFeed(Feed): - author_name = "CelcatSanitizer" - feed_type = Atom1Feed - +class RSSFeed(Feed): def get_object(self, request, year_slug, timetable_slug, group_slug): year, week = get_current_or_next_week() try: @@ -121,3 +119,9 @@ class AtomFeed(Feed): update.description = template.render(context) return obj[1] + + +class AtomFeed(RSSFeed): + author_name = settings.ADMINS[0][0] + author_email = settings.ADMINS[0][1] + feed_type = Atom1Feed diff --git a/templates/timetable.html b/templates/timetable.html index f4b8719..7a30595 100644 --- a/templates/timetable.html +++ b/templates/timetable.html @@ -6,4 +6,4 @@ <h2>{{ group.timetable }} – {{ group }} – Semaine {{ week }}</h2> <p>Dernière mise à jour le {{ last_update|date:"l j F o" }} à {{ last_update|date:"H:i" }}</p> {% include "timetable_common.html" %} - <p class="subscribe"><a href="{% url "ics" group.timetable.year.slug group.timetable.slug group.slug %}">ICS</a> – <a href="{% url "atom" group.timetable.year.slug group.timetable.slug group.slug %}">Atom</a><br /></p>{% endblock %} + <p class="subscribe"><a href="{% url "ics" group.timetable.year.slug group.timetable.slug group.slug %}">ICS</a> – <a href="{% url "rss" group.timetable.year.slug group.timetable.slug group.slug %}">RSS</a> – <a href="{% url "atom" group.timetable.year.slug group.timetable.slug group.slug %}">Atom</a></p>{% endblock %} @@ -23,5 +23,6 @@ urlpatterns = [ url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/$", views.timetable, name="timetable"), url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/calendar.ics$", feeds.IcalFeed(), name="ics"), url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/feed.atom$", feeds.AtomFeed(), name="atom"), + url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/feed.rss$", feeds.RSSFeed(), name="rss"), url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/(?P<year>[0-9]{4})/(?P<week>[0-4]?[0-9]|5[0-3])/$", views.timetable, name="timetable"), ] |