Questions tagged [django-signals]

Django signals allow listeners to be registered for events within the framework. This allows decoupled handling of, for example, model deletions.

Django signals allow listeners to be registered for events within the framework. This allows decoupled handling of, for example, model deletions.

Quote from docs:

Django includes a “signal dispatcher” which helps allow decoupled applications get notified when actions occur elsewhere in the framework. In a nutshell, signals allow certain senders to notify a set of receivers that some action has taken place. They’re especially useful when many pieces of code may be interested in the same events.

See documentation.

877 questions
0
votes
1 answer

Is there way to make costum signal when Manytomany relations created? Django!

Is there way to make custom signal when ManyToMany relations created?
Pol
  • 24,517
  • 28
  • 74
  • 95
0
votes
1 answer

How to use Django Signals to run a function after user registration completed?

I'm using django_registration_redux package to handle registering new users. Then I have a set of categories, which I want each new user to follow them by default. So I have to run following code immediately after a user object created: for category…
0
votes
0 answers

Getting information from the request into signals

I am working on a project using django-rest-framework 2.6 (we are planning to update to a newer version of the code, but that is not an option at this moment in time). We have many models and a request has come in to log when data is changed. In the…
James Hardy
  • 490
  • 4
  • 14
0
votes
0 answers

Add a custom field to django-watson

I want to include a custom field in the watson model SearchEntry as almost all my searches will include it. I've created a custom engine that creates a new field and index on install and linked to in settings: WATSON_BACKEND =…
PhoebeB
  • 8,434
  • 8
  • 57
  • 76
0
votes
1 answer

In Django how to stop a signal running during migrations

Is there a way in Django to stop a post_save signal from firing during the migration commands? I have a post_save signal which runs on all models, however I've found that during migrations it runs, although Django seems to deal with this problem…
Prometheus
  • 32,405
  • 54
  • 166
  • 302
0
votes
1 answer

Django - Perform queryset level task before delete

I have the following models: class Camera(models.Model) deleted_images_counter = models.IntegerField(...) class Image(models.Model) image = models.ImageField(....) camera = models.ForeignKey(Camera) Now, i want to update the camera…
Agey
  • 891
  • 8
  • 17
0
votes
1 answer

Error when updating username via a signal

I'm wondering how I can update a Django Users username. I am using the default auth model, with a OneToOne relationship for a custom Profile. The Profile can be updated via the end user, and a signal has been set to listen to the change and update…
Jamie S
  • 760
  • 3
  • 9
  • 19
0
votes
1 answer

fill with a default value in a blank/null False foreignkey field in Django model

class MyModel(models.Model): field1 = models.ForeignKey('AnotherModel', null=False, blank=False) field2 = #its a choice field # some more fields What I want is to fill the field1 with a default value if field2 is equal to some…
bakar
  • 1,152
  • 2
  • 11
  • 20
0
votes
1 answer

django signal sending email after registering user

i have a user model where after creating the model I want to send email from signal. I have a function in my signals.py def notify_after_registration(sender, instance, created, **kwargs): user = instance.username email_subject = 'Account…
gamer
  • 5,673
  • 13
  • 58
  • 91
0
votes
2 answers

django signal send email after registering user

I have gone through the documentation of signals, but didn't understand much. When I register a user a signal should be raised and a confirmation mail must be sent to the user. I didn't understand the process. Can someone give me a good example…
varad
  • 7,309
  • 20
  • 60
  • 112
0
votes
1 answer

Django 1.8: Function not called on Signal

I'm picking up on a code which should send a signal every time a user logs in. Thats not happening though. The function get_create_stripe() isnt getting called when the user logs in. Anyone can tell whats wrong? I'm working in Django 1.8 and the…
user248884
  • 851
  • 1
  • 11
  • 21
0
votes
1 answer

How can I get the results from the particular django-signals receiver?

I found this question but did not see any good answer to it: Getting information from Django custom signal receiver Here is my problem: Inside send_signals_and_get_transition_status() function I send 2 signals but in case first signal receiver's…
DNWS
  • 1
  • 3
0
votes
0 answers

Stopping User model from deleting an entry with signals

I am looking for a way to use Signals to stop the User model from deleting an entry, so I would not have to rewrite the User model. Instead, I'm looking to edit a model. A BooleanField is already set up. This way I can keep user in the database, and…
Termanater13
  • 45
  • 1
  • 8
0
votes
1 answer

Automatically connect signals to custom Django model fields

I've created a custom image field for Django that automatically creates thumbnails and does some other stuff. from django.db.models.fields.files import ImageFieldFile class ImageWithThumbsFieldFile(ImageFieldFile): def __init__(self, *args,…
Simon Steinberger
  • 6,605
  • 5
  • 55
  • 97
0
votes
2 answers

django-registration + ajax, user_registered signal randomly fails

I have "successfully" integrated django-registration with ajax in my project. I'm using the user_registered signal to add additional information to the user upon registering. Everything works whenever I test it personally. However, when I checked…
DigitalDouble
  • 1,747
  • 14
  • 26