Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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)