hackfest notifications design

3 views
Skip to first unread message

benny daon

unread,
Feb 18, 2009, 3:18:47 AM2/18/09
to pol...@googlegroups.com
  1. Suggesting to change django-notification to add Digest feature
  2. modify models.send_now
    1. Before the call to send_mail, there's a call to should_send
    2. Clone models.should_send and create new version called: should_send_digest
      1. modify should_send : check also a user settting called "digest_notifications"
      2. should_send_digest remains as is
    3. This way, the call to send_mail will be not be executed, & the notification will just be stored in the Notice table
  3. Add management command called: "deliver_digests" that:
    1. Loops on users having the "digest_notifications" settings set to True
    2. Create an empty list of notifications per user
    3. Loop on the notices for each user (models.notices_for)
    4. If should_send_digest returns true, add the notice to the list
    5. Create a template "digest_mail" that:
      1. Loops on a list of notices
      2. Creates an aggregated text
    6. Render the template using the list
    7. Call send_mail with the rendered template


Udi, Yehonatan, skibaa

daonb

unread,
Mar 1, 2009, 8:48:45 AM3/1/09
to polinax
Forked django-notification and made the required changes -
http://github.com/daonb/django-notification/tree/master
Changed the design a bit - d-n already supports medium types so I
added a digest-email medium type.
The management command is called emit_digest (emit_notices is already
defined) and it groups the notifications by type.

On Feb 18, 10:18 am, benny daon <bennyd...@gmail.com> wrote:
>    1. Suggesting to change django-notification to add Digest feature
>    2. modify models.send_now
>       1. Before the call to send_mail, there's a call to should_send
>       2. Clone models.should_send and create new version called:
>       should_send_digest
>          1. modify should_send : check also a user settting called
>          "digest_notifications"
>          2. should_send_digest remains as is
>          3. This way, the call to send_mail will be not be executed, & the
>       notification will just be stored in the Notice table
>    3. Add management command called: "deliver_digests" that:
>       1. Loops on users having the "digest_notifications" settings set to
>       True
>       2. Create an empty list of notifications per user
>       3. Loop on the notices for each user (models.notices_for)
>       4. If should_send_digest returns true, add the notice to the list
>       5. Create a template "digest_mail" that:
>          1. Loops on a list of notices
>          2. Creates an aggregated text
>       6. Render the template using the list
>       7. Call send_mail with the rendered template
>
> Udi, Yehonatan, skibaa
Reply all
Reply to author
Forward
0 new messages