diff --git a/greenmine/base/notifications/api.py b/greenmine/base/notifications/api.py index 0c10a269..cebc0305 100644 --- a/greenmine/base/notifications/api.py +++ b/greenmine/base/notifications/api.py @@ -8,7 +8,7 @@ class NotificationSenderMixin(object): update_notification_template = None destroy_notification_template = None - def _send_notification_email(template_method, users=None, context=None): + def _send_notification_email(self, template_method, users=None, context=None): mails = template_mail.MagicMailBuilder() for user in users: email = getattr(mails, template_method)(user, context) @@ -28,6 +28,7 @@ class NotificationSenderMixin(object): self._send_notification_email(self.update_notification_template, users=users, context=context) def destroy(self, request, *args, **kwargs): + obj = self.get_object() users = obj.get_watchers_to_notify(self.request.user) context = { 'changer': self.request.user, diff --git a/greenmine/base/notifications/models.py b/greenmine/base/notifications/models.py index 8e1a6bf3..19bf1cc0 100644 --- a/greenmine/base/notifications/models.py +++ b/greenmine/base/notifications/models.py @@ -64,8 +64,8 @@ class WatchedMixin(object): return version_list and version_list[0] or None def get_changed_fields_dict(self, data_dict): - if self.notified_fields: - changed_data = dict((k, d[k]) for k in data_dict if k in self.notifiable_fields) + if self.notifiable_fields: + changed_data = dict((k, v) for k, v in data_dict.items() if k in self.notifiable_fields) else: changed_data = data_dict diff --git a/greenmine/scrum/management/commands/sample_data.py b/greenmine/scrum/management/commands/sample_data.py index 3b9b6656..ed772b85 100644 --- a/greenmine/scrum/management/commands/sample_data.py +++ b/greenmine/scrum/management/commands/sample_data.py @@ -81,8 +81,8 @@ class Command(BaseCommand): bug = self.create_bug(project) # create questions. - for y in xrange(self.sd.int(15,25)): - question = self.create_question(project) + #for y in xrange(self.sd.int(15,25)): + # question = self.create_question(project) def create_question(self, project): question = Question.objects.create( @@ -163,9 +163,10 @@ class Command(BaseCommand): points=points, role=role) - for tag in self.sd.words().split(" "): + for tag in self.sd.words(1, 3).split(" "): us.tags.append(tag) + us.save() return us def create_milestone(self, project, start_date, end_date):