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

There is no need to save default NoticeSetting instances. Under some rar... #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion notification/atomformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Feed(object):
VALIDATE = True


def __init__(self, slug, feed_url):
def __init__(self, slug=None, feed_url=None):
# @@@ slug and feed_url are not used yet
pass

Expand Down
1 change: 0 additions & 1 deletion notification/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def get_notification_setting(user, notice_type, medium):
except NoticeSetting.DoesNotExist:
default = (NOTICE_MEDIA_DEFAULTS[medium] <= notice_type.default)
setting = NoticeSetting(user=user, notice_type=notice_type, medium=medium, send=default)
setting.save()
return setting

def should_send(user, notice_type, medium):
Expand Down
12 changes: 5 additions & 7 deletions notification/views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect, Http404
from django.http import HttpResponseRedirect, Http404, HttpResponse
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.contrib.syndication.views import feed

from notification.models import *
from notification.decorators import basic_auth_required, simple_basic_auth_callback
Expand All @@ -15,11 +14,10 @@ def feed_for_user(request):
"""
An atom feed for all unarchived :model:`notification.Notice`s for a user.
"""
url = "feed/%s" % request.user.username
return feed(request, url, {
"feed": NoticeUserFeed,
})

feedgen = NoticeUserFeed().get_feed(request.user.username)
response = HttpResponse(mimetype=feedgen.mime_type)
feedgen.write(response, 'utf-8')
return response

@login_required
def notices(request):
Expand Down