You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

services.py 440B

123456789101112131415161718
  1. from oscar.core.loading import get_model
  2. Notification = get_model('customer', 'Notification')
  3. def notify_user(user, msg, **kwargs):
  4. """
  5. Send a simple notification to a user
  6. """
  7. Notification.objects.create(recipient=user, subject=msg, **kwargs)
  8. def notify_users(users, msg, **kwargs):
  9. """
  10. Send a simple notification to an iterable of users
  11. """
  12. for user in users:
  13. notify_user(user, msg, **kwargs)