def __init__(self, *args, **kwargs):
"""Initializes a new instance of :see:PostgresManager."""
super(PostgresManager, self).__init__(*args, **kwargs)
# make sure our back-end is set and refuse to proceed
# if it's not set
db_backend = settings.DATABASES['default']['ENGINE']
if 'psqlextra' not in db_backend:
raise ImproperlyConfigured((
'\'%s\' is not the \'psqlextra.backend\'. '
'django-postgres-extra cannot function without '
'the \'psqlextra.backend\'. Set DATABASES.ENGINE.'
) % db_backend)
# hook into django signals to then trigger our own
django.db.models.signals.post_save.connect(
self._on_model_save, sender=self.model, weak=False)
django.db.models.signals.pre_delete.connect(
self._on_model_delete, sender=self.model, weak=False)
self._signals_connected = True
评论列表
文章目录