gealogiuya
Some checks failed
Deploy Django Application to Server / deploy (push) Failing after 19s
Telegram Notifications / Telegram Gate (push) Failing after 5s

This commit is contained in:
2026-02-27 14:56:23 +05:00
commit 0229a0595c
118 changed files with 33948 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
from django.db.models.signals import m2m_changed
from django.dispatch import receiver
from apps.geology.models import GalleryCategory
@receiver(m2m_changed, sender=GalleryCategory.gallery.through)
def gallery_category_m2m_changed(sender, instance, action, **kwargs):
if action in ["post_add", "post_remove", "post_clear"]:
instance.count = instance.gallery.count()
print(instance.count)
instance.save()