Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

services.py 482B

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)