tangentlabs/django-oscar — pull request #286 by elbaschid (2012-08-30 06:22:05+00:00)
Title: Adds changes as requested in PR #269

This pull request includes the changes requested in PR #269 with the following major feature additions:

1. Management command to send notifications for products that are available to buy and disabling the notifications. This comes with a new option ``OSCAR_INSTANT_NOTIFICATION_ENABLED`` that allows for disabling the default behaviour to send out notifications immediately whenever a ``StockRecord`` is updated.
2. Moving most of the functionality of ``ProductNotification`` into the ``AbstractNotification`` model. I added a new attribute to the model class called ``item_field_name`` that is used to retrieve the field name used in the subclass to reference the notification item. This makes it possible to move the ``get_notification_item``, ``get_confirm_url`` and ``get_unsubscribe_url`` methods into the abstract base class. This was the most sensible solution to me and prevent an issue with having ``ProductNotification`` defined as abstract class which causes an issue with having the same ``related_name`` for the ``user`` attribute in ``AbstractNotification`` and ``AbstractProductNotification``. Adding a class-name-dependent ``related_name`` does not provide a good solution in my opiniion as all notifications would be separate attributes on the user model. The current implementation shows all notifications derived from ``Notification`` in the ``notifications`` attribute for the user.

Please let me know what you think. Any feedback welcome and this time it won't take me as long to get the changes implemented :)