Skip to content

Commit

Permalink
BACKWARD INCOMPATIBLE: renamed Notice.user to Notice.recipient and ch…
Browse files Browse the repository at this point in the history
…anged its context variable to match

This change is being made to clarify the purpose of the User FK on Notice.
  • Loading branch information
brosner committed Dec 11, 2009
1 parent 91d9a2f commit 5202196
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
@@ -1,3 +1,11 @@
BI = backward incompatible change

0.2.0
-----

* BI: renamed Notice.user to Notice.recipient
* BI: renamed {{ user }} context variable in notification templates to {{ recipient }}

0.1.5
-----

Expand Down
6 changes: 3 additions & 3 deletions notification/models.py
Expand Up @@ -123,7 +123,7 @@ def unseen_count_for(self, user, **kwargs):

class Notice(models.Model):

user = models.ForeignKey(User, verbose_name=_('user'))
recipient = models.ForeignKey(User, verbose_name=_('recipient'))
message = models.TextField(_('message'))
notice_type = models.ForeignKey(NoticeType, verbose_name=_('notice type'))
added = models.DateTimeField(_('added'), default=datetime.datetime.now)
Expand Down Expand Up @@ -282,7 +282,7 @@ def send_now(users, label, extra_context=None, on_site=True):

# update context with user specific translations
context = Context({
"user": user,
"recipient": user,
"notice": ugettext(notice_type.display),
"notices_url": notices_url,
"current_site": current_site,
Expand All @@ -301,7 +301,7 @@ def send_now(users, label, extra_context=None, on_site=True):
'message': messages['full.txt'],
}, context)

notice = Notice.objects.create(user=user, message=messages['notice.html'],
notice = Notice.objects.create(recipient=user, message=messages['notice.html'],
notice_type=notice_type, on_site=on_site)
if should_send(user, notice_type, "1") and user.email: # Email
recipients.append(user.email)
Expand Down

0 comments on commit 5202196

Please sign in to comment.