Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021
  1. from django.db.models import get_model
  2. Notification = get_model('customer', 'Notification')
  3. def notify_user(user, msg, category=None):
  4. """
  5. Send a simple notification to a user
  6. """
  7. Notification.objects.create(
  8. recipient=user,
  9. subject=msg,
  10. category=category)
  11. def notify_users(users, msg, category=None):
  12. """
  13. Send a simple notification to an iterable of users
  14. """
  15. for user in users:
  16. notify_user(user, msg, category)