This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Django Query Signals

What is it?

A library that will send signals on queryset data manipulation methods.

What problem does it solve?

Django sends many signals, including when a model instance is created, deleted and updated. However when using bulk methods like bulk_create or delete. There is no signal send, with this library signals are send on the following methods:

  • bulk_create
  • delete
  • get_or_create
  • update_or_create
  • update

A signal will be send before and after the method is executed.

How do I install it?

pip install django-query-signals

Adding to Django (using integrator)

>>> import django_integrator
>>> django_integrator.add_application('django_query_signals')

If you don’t want to use the above, you can just add ‘django_query_signals’ to your installed apps.

How do I use it?

From the namespace django_query_signals you can import the below signals which you can connect to via the usual way.

  • pre_bulk_create
  • post_bulk_create,
  • pre_delete
  • post_delete
  • pre_get_or_create
  • post_get_or_create
  • pre_update_or_create
  • post_update_or_create
  • pre_update
  • post_update

For example:

>>> @receiver(post_bulk_create)
>>> def callback(signal, sender, args):
>>>       pass

The argument ‘signal’ is the signal that is connected, ‘sender’ is the underlying model class and ‘args’ is a dictionary which the method in queryset is called with, this is supplemented with ‘self’ which contains the queryset instance and if the connecting signal is a ‘post’ type the key ‘return’ is also added which contains the value the method has returned.

If you connect to the ‘pre’ type signal, changing the ‘args’ and ‘self’ will also change the actual execution of the method.

Caveat

This library relies on monkey patching django.db.models.query.QuerySet, thus if your instance also monkey patches the same thing or you use a custom QuerySet in your Manager, then there is a good chance that this library will not work at all for you, however most likely you can work around this issue by examining the signals.py file in this library.

What license is this?

Two-clause BSD

How can I get support?

Please use the repo’s bug tracker to leave behind any questions, feedback, suggestions and comments. I will handle them depending on my time and what looks interesting. If you require guaranteed support please contact me via e-mail so we can discuss appropriate compensation.

Signing Off

Is my work helpful or valuable to you? You can repay me by donating via:

https://paypal.me/MartinHellwig

-or-

https://www.patreon.com/hellwig

Thank you!

Release History

Release History

0.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-query-signals-0.0.2.tar.gz (6.0 kB) Copy SHA256 Checksum SHA256 Source Sep 12, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting