From fbec917229c76da4c82fc24e66a054e937e750b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Thu, 18 Jul 2013 15:38:49 +0200 Subject: [PATCH] Made some minor fixes in the notifications app --- greenmine/base/notifications/models.py | 17 ++++++++++------- .../update_issue_notification-body-html.jinja | 2 +- .../update_issue_notification-body-text.jinja | 2 +- ...pdate_milestone_notification-body-html.jinja | 2 +- ...pdate_milestone_notification-body-text.jinja | 2 +- .../update_project_notification-body-html.jinja | 2 +- .../update_project_notification-body-text.jinja | 2 +- .../update_task_notification-body-html.jinja | 2 +- .../update_task_notification-body-text.jinja | 2 +- ...date_user_story_notification-body-html.jinja | 2 +- ...date_user_story_notification-body-text.jinja | 2 +- greenmine/settings/common.py | 4 ++-- requirements.txt | 3 ++- 13 files changed, 24 insertions(+), 20 deletions(-) diff --git a/greenmine/base/notifications/models.py b/greenmine/base/notifications/models.py index 19bf1cc0..83467690 100644 --- a/greenmine/base/notifications/models.py +++ b/greenmine/base/notifications/models.py @@ -16,9 +16,9 @@ class WatcherMixin(object): ("no_events", _(u"No events")), ) - notify_level = models.CharField(max_length=32, null=False, blank=False, default="only_watching", + notify_level = models.CharField(max_length=32, null=False, blank=False, default="all_owned_projects", choices=NOTIFY_LEVEL_CHOICES, verbose_name=_(u"notify level")) - notify_changes_by_me = models.BooleanField(null=False, blank=True, + notify_changes_by_me = models.BooleanField(null=False, blank=True, default=True, verbose_name=_(u"notify changes made by me")) class Meta: @@ -95,11 +95,14 @@ class WatchedMixin(object): and suscribed_watcher.allow_notify_by_me(changer)): watchers_to_notify.add(suscribed_watcher) - #(project, project_owner) = watchers_by_role.get("project_owner") - #if project_owner \ - # and project_owner.allow_notify_project(project) \ - # and project_owner.allow_notify_by_me(self._changer): - # watchers_to_notify.add(project_owner) + (project, project_owner) = watchers_by_role.get("project_owner") + if project_owner \ + and project_owner.allow_notify_project(project) \ + and project_owner.allow_notify_by_me(self._changer): + watchers_to_notify.add(project_owner) + + if changer.notify_changes_by_me: + watchers_to_notify.add(changer) return watchers_to_notify diff --git a/greenmine/scrum/templates/emails/update_issue_notification-body-html.jinja b/greenmine/scrum/templates/emails/update_issue_notification-body-html.jinja index 83ae3ce6..7217ab34 100644 --- a/greenmine/scrum/templates/emails/update_issue_notification-body-html.jinja +++ b/greenmine/scrum/templates/emails/update_issue_notification-body-html.jinja @@ -1,6 +1,6 @@

Updated fields by {{ changer }}:

diff --git a/greenmine/scrum/templates/emails/update_issue_notification-body-text.jinja b/greenmine/scrum/templates/emails/update_issue_notification-body-text.jinja index d8240bd0..9ac8d7b2 100644 --- a/greenmine/scrum/templates/emails/update_issue_notification-body-text.jinja +++ b/greenmine/scrum/templates/emails/update_issue_notification-body-text.jinja @@ -1,6 +1,6 @@ Updated fields by {{ changer }}: -{% for field in changed_fields %} +{% for field in changed_fields_dict.values() %} ** {{ field.verbose_name}}: from "{{ field.old_value}}" to "{{ field.new_value}}". {% endfor %} diff --git a/greenmine/scrum/templates/emails/update_milestone_notification-body-html.jinja b/greenmine/scrum/templates/emails/update_milestone_notification-body-html.jinja index 25526927..e5708f8b 100644 --- a/greenmine/scrum/templates/emails/update_milestone_notification-body-html.jinja +++ b/greenmine/scrum/templates/emails/update_milestone_notification-body-html.jinja @@ -1,6 +1,6 @@

Updated fields by {{ changer }}:

diff --git a/greenmine/scrum/templates/emails/update_milestone_notification-body-text.jinja b/greenmine/scrum/templates/emails/update_milestone_notification-body-text.jinja index d8240bd0..9ac8d7b2 100644 --- a/greenmine/scrum/templates/emails/update_milestone_notification-body-text.jinja +++ b/greenmine/scrum/templates/emails/update_milestone_notification-body-text.jinja @@ -1,6 +1,6 @@ Updated fields by {{ changer }}: -{% for field in changed_fields %} +{% for field in changed_fields_dict.values() %} ** {{ field.verbose_name}}: from "{{ field.old_value}}" to "{{ field.new_value}}". {% endfor %} diff --git a/greenmine/scrum/templates/emails/update_project_notification-body-html.jinja b/greenmine/scrum/templates/emails/update_project_notification-body-html.jinja index 25526927..e5708f8b 100644 --- a/greenmine/scrum/templates/emails/update_project_notification-body-html.jinja +++ b/greenmine/scrum/templates/emails/update_project_notification-body-html.jinja @@ -1,6 +1,6 @@

Updated fields by {{ changer }}:

diff --git a/greenmine/scrum/templates/emails/update_project_notification-body-text.jinja b/greenmine/scrum/templates/emails/update_project_notification-body-text.jinja index d8240bd0..9ac8d7b2 100644 --- a/greenmine/scrum/templates/emails/update_project_notification-body-text.jinja +++ b/greenmine/scrum/templates/emails/update_project_notification-body-text.jinja @@ -1,6 +1,6 @@ Updated fields by {{ changer }}: -{% for field in changed_fields %} +{% for field in changed_fields_dict.values() %} ** {{ field.verbose_name}}: from "{{ field.old_value}}" to "{{ field.new_value}}". {% endfor %} diff --git a/greenmine/scrum/templates/emails/update_task_notification-body-html.jinja b/greenmine/scrum/templates/emails/update_task_notification-body-html.jinja index 25526927..e5708f8b 100644 --- a/greenmine/scrum/templates/emails/update_task_notification-body-html.jinja +++ b/greenmine/scrum/templates/emails/update_task_notification-body-html.jinja @@ -1,6 +1,6 @@

Updated fields by {{ changer }}:

diff --git a/greenmine/scrum/templates/emails/update_task_notification-body-text.jinja b/greenmine/scrum/templates/emails/update_task_notification-body-text.jinja index d8240bd0..9ac8d7b2 100644 --- a/greenmine/scrum/templates/emails/update_task_notification-body-text.jinja +++ b/greenmine/scrum/templates/emails/update_task_notification-body-text.jinja @@ -1,6 +1,6 @@ Updated fields by {{ changer }}: -{% for field in changed_fields %} +{% for field in changed_fields_dict.values() %} ** {{ field.verbose_name}}: from "{{ field.old_value}}" to "{{ field.new_value}}". {% endfor %} diff --git a/greenmine/scrum/templates/emails/update_user_story_notification-body-html.jinja b/greenmine/scrum/templates/emails/update_user_story_notification-body-html.jinja index 25526927..e5708f8b 100644 --- a/greenmine/scrum/templates/emails/update_user_story_notification-body-html.jinja +++ b/greenmine/scrum/templates/emails/update_user_story_notification-body-html.jinja @@ -1,6 +1,6 @@

Updated fields by {{ changer }}:

diff --git a/greenmine/scrum/templates/emails/update_user_story_notification-body-text.jinja b/greenmine/scrum/templates/emails/update_user_story_notification-body-text.jinja index 78481646..3192319b 100644 --- a/greenmine/scrum/templates/emails/update_user_story_notification-body-text.jinja +++ b/greenmine/scrum/templates/emails/update_user_story_notification-body-text.jinja @@ -1,6 +1,6 @@ Updated fields by {{ changer }}: -{% for field in changed_fields %} +{% for field in changed_fields_dict.values() %} ** {{ field.verbose_name}}: from "{{ field.old_value}}" to "{{ field.new_value}}". {% endfor %} diff --git a/greenmine/settings/common.py b/greenmine/settings/common.py index 7e3674bc..737ae5fb 100644 --- a/greenmine/settings/common.py +++ b/greenmine/settings/common.py @@ -158,8 +158,8 @@ STATICFILES_FINDERS = [ SECRET_KEY = 'aw3+t2r(8(0kkrhg8)gx6i96v5^kv%6cfep9wxfom0%7dy0m9e' TEMPLATE_LOADERS = [ - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', + 'django_jinja.loaders.AppLoader', + 'django_jinja.loaders.FileSystemLoader', ] MIDDLEWARE_CLASSES = [ diff --git a/requirements.txt b/requirements.txt index add67eec..48c9bddd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,4 +28,5 @@ python-dateutil==2.1 pytz==2013b six==1.3.0 djmail>=0.1 - +jinja2==2.7 +pygments==1.6