From b7570ece15c4708e32c6549682637c6c1a370a18 Mon Sep 17 00:00:00 2001 From: Calvin Cheng Date: Mon, 29 Oct 2012 19:05:07 +0800 Subject: [PATCH] Feed, not feed, when importing from django.contrib.syndication.views --- notification/views.py | 50 +++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/notification/views.py b/notification/views.py index e60b4483..82a28ab2 100644 --- a/notification/views.py +++ b/notification/views.py @@ -4,7 +4,7 @@ from django.template import RequestContext from django.contrib.auth.decorators import login_required -from django.contrib.syndication.views import feed +from django.contrib.syndication.views import Feed from notification.models import * from notification.decorators import basic_auth_required, simple_basic_auth_callback @@ -26,17 +26,17 @@ def feed_for_user(request): def notices(request): """ The main notices index view. - + Template: :template:`notification/notices.html` - + Context: - + notices A list of :model:`notification.Notice` objects that are not archived and to be displayed on the site. """ notices = Notice.objects.notices_for(request.user, on_site=True) - + return render_to_response("notification/notices.html", { "notices": notices, }, context_instance=RequestContext(request)) @@ -46,14 +46,14 @@ def notices(request): def notice_settings(request): """ The notice settings view. - + Template: :template:`notification/notice_settings.html` - + Context: - + notice_types A list of all :model:`notification.NoticeType` objects. - + notice_settings A dictionary containing ``column_headers`` for each ``NOTICE_MEDIA`` and ``rows`` containing a list of dictionaries: ``notice_type``, a @@ -80,16 +80,16 @@ def notice_settings(request): setting.save() settings_row.append((form_label, setting.send)) settings_table.append({"notice_type": notice_type, "cells": settings_row}) - + if request.method == "POST": next_page = request.POST.get("next_page", ".") return HttpResponseRedirect(next_page) - + notice_settings = { "column_headers": [medium_display for medium_id, medium_display in NOTICE_MEDIA], "rows": settings_table, } - + return render_to_response("notification/notice_settings.html", { "notice_types": notice_types, "notice_settings": notice_settings, @@ -100,16 +100,16 @@ def notice_settings(request): def single(request, id, mark_seen=True): """ Detail view for a single :model:`notification.Notice`. - + Template: :template:`notification/single.html` - + Context: - + notice The :model:`notification.Notice` being viewed - + Optional arguments: - + mark_seen If ``True``, mark the notice as seen if it isn't already. Do nothing if ``False``. Default: ``True``. @@ -131,12 +131,12 @@ def archive(request, noticeid=None, next_page=None): Archive a :model:`notices.Notice` if the requesting user is the recipient or if the user is a superuser. Returns a ``HttpResponseRedirect`` when complete. - + Optional arguments: - + noticeid The ID of the :model:`notices.Notice` to be archived. - + next_page The page to redirect to when done. """ @@ -159,12 +159,12 @@ def delete(request, noticeid=None, next_page=None): Delete a :model:`notices.Notice` if the requesting user is the recipient or if the user is a superuser. Returns a ``HttpResponseRedirect`` when complete. - + Optional arguments: - + noticeid The ID of the :model:`notices.Notice` to be archived. - + next_page The page to redirect to when done. """ @@ -185,9 +185,9 @@ def delete(request, noticeid=None, next_page=None): def mark_all_seen(request): """ Mark all unseen notices for the requesting user as seen. Returns a - ``HttpResponseRedirect`` when complete. + ``HttpResponseRedirect`` when complete. """ - + for notice in Notice.objects.notices_for(request.user, unseen=True): notice.unseen = False notice.save()