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

Django - multiple profiles

In my project I have two different types of users: teacher and student, each with their own profile data. After searching for the best approach it seems the way to go forward is using multi-table inheritance: class BaseProfile(models.Model): …
Köver
  • 371
  • 4
  • 12
0
votes
1 answer

Django 1.1 Signals - Strange timing issue with thread

I have a model (PurchaseOrder - abbreviated PO) holding a time budget. Users can add hour records to this budget, where each hour record reduces the remaining budget. I implemented signals for updating the remaining budget. After adding an hour…
Thomas Kremmel
  • 14,575
  • 26
  • 108
  • 177
0
votes
1 answer

django-social-auth profile builder

I recently started playing around with django-social-auth and am looking for some help from the community to figure out the best way to move forward with an idea. Once a user has registered you have access to his oauth token which allows you to pull…
ApPeL
  • 4,801
  • 9
  • 47
  • 84
0
votes
1 answer

django signals received by only one function

I have a model that sends signal: class WMTransaction(models.Model): def save(self, *args, **kwargs): if self.status == 'completed': self.completed = datetime.datetime.now() try: old =…
Kirill Bubochkin
  • 5,868
  • 2
  • 31
  • 50
-1
votes
1 answer

Django signal mystery...development server vs. remote server

After many hours of hair pulling, I look to stackoverflow to help me solve this issue. I have create two signals to run auto-email functions. The signals are triggered via a modification of save_model in my admin.py file. The only problem is...BOTH…
Nathan Katz
  • 739
  • 1
  • 7
  • 12
-1
votes
1 answer

Django post_save signal, executing chained tasks

When I save a model I want to create some folders, then download a few things to those folders. Folders need to be created for the downloads, obviously, downloads can happen in parallel. HEre's what I have: @receiver(post_save, sender=Game) def…
Daviid
  • 630
  • 4
  • 17
-1
votes
1 answer

How To Run Discord bot inside Django and use signals with it

So I have created my django website and. I want to run my discord bot inside my django website And also **can I use the signals to send a message on my server if post have been crated ** So any one can help me how to do that
7mood
  • 5
  • 5
-1
votes
1 answer

Django signals don't work with DEBUG=False

I have the following code that work fine in development mode with DEBUG=True. In a nutshell - signal should invalidate a cache. The project running Django 4.0, Python 3.9, MySQL MarialDB 10.2 signals.py from django.core.cache import cache from…
Vitalii Mytenko
  • 544
  • 5
  • 20
-1
votes
2 answers

Django registration different type users with different fields

I need to create two different users: Gym and Client. The client should theoretically be connected by a many-to-many bond because he can be enrolled in multiple gyms. My doubt is about user registration. I found this around: class…
-1
votes
1 answer

In django signals, how to pass sender's class variables (model fields) to receiver (management.call_command function) and use it

I am building a multi-tenant project using third-party package (django-tenants) which makes me derive the Tenant and Domain models from it's own classes: from django_tenants.models import TenantMixin, DomainMixin class Tenant(TenantMixin): name…
illevens
  • 343
  • 1
  • 13
-1
votes
1 answer

Django cannot update second field with signal

When i add client to Client table, it's added automatically with signals to ClientsBalance. But the company field on ClientsBalance table is not updated to the current company (company=user.company), i would like that this field contain the current…
-1
votes
2 answers

Django post save signal not updating the database

Im not getting why this signal is not working. This same code worked once but after that i deleted the objects from admin and ran it again and it stopped working. @receiver(post_save, sender=FinancePending) def calcualate_FinancePending(sender,…
-1
votes
1 answer

How to use post_save signal with custom user model extended with AbstractBaseUser

There are two apps in my ecommerce website and i have been following a particular tutorial on youtube. In the course, the guy used django-allauth package for login purposes. I followed the course along but I created custom user model exending…
-1
votes
1 answer

Django IntegrityError on profile creation

Why am I getting the Integrity Error despite the fact that I'm checking that the username is unique here: (I also tried try/expect IntegretyError instead of e.count()) # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db…
4m1nh4j1
  • 4,289
  • 16
  • 62
  • 104
-1
votes
1 answer

Checking for a condition in signals.py using a variable passed in a method existing in views.py - django

I'm trying to evaluate a situation here. I have a custom user Model (Using AbstractUser) that contains an extra field called 'role'. I can access the value of this field in views.py using a variable. Now I want to use that variable to check for a…
Abedy
  • 361
  • 5
  • 17
1 2 3
58
59