Django signals / notification system

Is it a good aproach to use Django signals to implement email notification system? I have CustomUser model related with CustomUserPreferences planned as follows:

class CustomUserPreferences(models.Model):
    user = models.OneToOneField(settings.AUTH_USER_MODEL, default=None, on_delete = models.CASCADE, primary_key = True)
    lesson_notification = models.BooleanField(default=True)
    journal_notification = models.BooleanField(default=False)
    login_notification = models.BooleanField(default=False)
    excercise_notification = models.BooleanField(default=False)
    homework_notification = models.BooleanField(default=True)


class CustomUser(AbstractUser):
    ...
    email = models.EmailField(_('email address'), unique=True)
    preferences = models.OneToOneField(CustomUserPreferences, null = True ,default=None, on_delete = models.CASCADE)
    students = models.ManyToManyField(to = 'self', related_name = 'teachers', symmetrical = False, blank = True)

Whenever a new object of lets say Lesson is created I want to send an email to the user and that's fine - becaouse it won't overload any server.

The question is: will it pay off to use signals for a list of users that contains lets say 100s or 1000s of users? I'm afraid it will slow down the whole application.

Is there any other "clear and elegant" way to do this? Django docs advices not to use signals whenever it's possible.

Back to Top