rmoch avatar rmoch committed b126198

bugfix and comment

Comments (0)

Files changed (3)

 Notifications are short emails sent to users by Facebook or Twitter to inform users of some changes.
-django-email-notification allow you to send short email notifications to django registered users and also to users you only know the email about what is new or changed. And track their clicks.
+django-email-notification allows backoffice users to send short email notifications to django registered users or users you only know the email about what is new or changed from django's admin or a dedicated view. And then track their clicks.
             'description': u"New products",                         # Human readable description
             'long_description': u"Last products added to our site", # Long description
             'class': 'project.application.models.Product',          # path to the class model
-            'title_attr': 'product_description',                    # Model instance field to display in form, can be a callable
+            'title_attr': 'product_description',                    # Model instance field or callable to display in form
             'order_by': '-creation_date',                           # order to sort Model instances in form and email template
             'manager': '',                                          # manager to use if so


     def save(self, *args, **kwargs):
         super(NotificationFormAdmin, self).save(*args, **kwargs)
+        self.instance.save()
         return self.instance
     def save_model(self, request, obj, form, change):
         super(NotificationAdmin, self).save_model(request, obj, form, change)
-        if "save-and-send" in request.POST:
+        if 'save-and-send' in request.POST:
+            form.save_m2m()  # slightly anticipate m2m saving
 admin.site.register(Notification, NotificationAdmin)


 class SimpleRegistration(ModelWithMD5):
+    """Users who registered to notifications but are not Django users. Only email is required."""
     registration_date = models.DateTimeField(auto_now_add=True, verbose_name=_(u"Registration date"))
     email = models.EmailField(verbose_name=_(u"Email"))
     first_name = models.CharField(max_length=70, blank=True, verbose_name=_(u"First name"))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.