Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1013403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:05:46+00:00 2026-05-16T10:05:46+00:00

I am working on a django project, where I want to implement a signal

  • 0

I am working on a django project, where I want to implement a signal which should be called when some user address is changed. I have seen the built-in signals but they do not seem to work in my case, because if i use save that will be called in other save events as well and though I am able to create a custom signal, I could not find out, how should I call this ?

Please suggest.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:05:46+00:00Added an answer on May 16, 2026 at 10:05 am

    Start by defining a custom signal. A custom signal here is a sub class of django.dispatch.Signal. This code can live in app/signals.py.

    from django.dispatch import Signal
    user_address_changed = Signal(providing_args=["user"])
    

    Next, make sure you send this signal when your user’s address is changed. Depending on how you have defined User and Address this can be done in different places. Let us assume that there is a view that lets users update their Address models. This code is presumably in app/views.py.

    from app import signals
    
    def update_address(request, *args, **kwargs):
        # all the changes go well.
        signals.user_address_changed.send(sender=None, user=request.user)
        # Render to template etc.
    

    Now you need to set up a receiver for this signal.

    from app.signals import user_address_changed
    
    def handle_user_address_change(sender, **kwargs):
        """Trap the signal and do whatever is needed"""
        user = kwargs['user']
        # Write to log, update db, send mail etc.
    
    user_address_changed.connect(handle_user_address_change)
    

    Update

    (After reading comment; the OP explains that there is no separate view that updates address) In that case you can try to override User.save() to send out this signal. I say “try” because I do not know if you are using your own User class or auth.User.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a django project that I have been working on as a solo
Am working with django Publisher example, I want to list all the publishers in
I'm working on a blog application in Django. Naturally, I have models set up
I am working through the examples in a Django book that I have, but
I'm working on a django project that serves multiple sites; depending on the site
I'm working on a Django project that contains a single application. The application will
I am working on a Django project. And our team follows agile practices(TDD,very short
I'm working on a Django project. Let's call it myproject . Now my code
I am working with a django project, I haven't started. The developed working on
I'm working on a small django project that will be deployed in a servlet

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.