# blog/signals.py
from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import Article
from programmer.models import Profile
from django.core.mail import send_mail

@receiver(post_save, sender=Article)
def notify_about_new_article(sender, instance, created, **kwargs):
    if created and instance.is_published:
        profiles = Profile.objects.filter(notify_new_articles=True, user__is_active=True)
        emails = [p.user.email for p in profiles if p.user.email]
        # отправка письма (можно асинхронно)