Test if post_save is called

This commit is contained in:
M1ha 2019-01-23 12:48:18 +05:00
parent cac5fe9d52
commit 241618d8ca

View File

@ -10,6 +10,7 @@ from django.db import transaction
from django.db.models.signals import post_save, post_delete
from django.dispatch import receiver
from django.db.models import QuerySet as DjangoQuerySet, Manager as DjangoManager, Model as DjangoModel
from statsd.defaults.django import statsd
from .configuration import config
from .storages import Storage
@ -193,6 +194,7 @@ class ClickHouseSyncModel(DjangoModel):
@receiver(post_save)
def post_save(sender, instance, **kwargs):
statsd.incr('clickhouse.sync.post_save'.format('post_save'), 1)
if issubclass(sender, ClickHouseSyncModel):
instance.post_save(kwargs.get('created', False), using=kwargs.get('using'))