Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

django.contrib.syndication.views -- Feed, not feed #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions notification/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -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``.
Expand All @@ -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.
"""
Expand All @@ -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.
"""
Expand All @@ -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()
Expand Down