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

  • SEARCH
  • Home
  • 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 9113173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:54:23+00:00 2026-06-17T03:54:23+00:00

I am using signals to send a mail and is working fine(right now I

  • 0

I am using signals to send a mail and is working fine(right now I am testing it and providing the static email address). But I want to use Dynamic values of model fields in my mail function.

e.g. If admin changes anything from admin dashboard in that model a signal is called using post_save and a mail function is called so. But I need id of that user from this model so that I can fetch his name,email_address from auth_user table.

I am sending the name of the model in post_save but i don’t know how to use their fields in signals if possible.

right now I am using this code.

My model

class ABC(models.Model):
  .....
  .......

post_save.connect(handlers.model_saved, sender=ABC)

the signal which is called.

from django.core.mail import send_mail


def model_saved(sender, **kwargs):
    send_mail('Subject here', 'Here is the message.', 'from@example.com',
    ['ndhiman08@gmail.com'], fail_silently=False)
    print "SAVED",sender,kwargs

Terminal response

<class 'XYZ.models.ABC'> {'raw': False, 'instance': <ABC: #1 admin admin 2013-01-04 04:20:50+00:00>, 'signal': <django.dispatch.dispatcher.Signal object at 0xb612584c>, 'using': 'default', 'created': False}

Please suggest me some way so that i can use vales of my model fields in signals.

Thanks.

  • 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-06-17T03:54:24+00:00Added an answer on June 17, 2026 at 3:54 am

    There is instance argument provided to signal handler which is the Model object saved.
    So you can use it as :

    def model_saved(sender, **kwargs):
        send_mail('Subject here', 'Here is the message.', 'from@example.com',
        ['ndhiman08@gmail.com'], fail_silently=False)
        abc_obj = kwargs['instance']
        #can use fields as 
        #abc_obj.somefield
        print "SAVED",sender,kwargs
    

    post_save documentation explains this.

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

Sidebar

Related Questions

I'm using MFMailComposeViewController to send email. But it crashed when sending large attachments, because
I want to send signals via serial port using the JavaComm API classes on
I want to send objects from Javascript to Server using Signalr, but the server
I am using pcntl_fork to start a child process to send an email via
Django is sending the pre/post_delete signals if you are using the queryset.delete() method, but
I know how to send signals to child process in C using the kill(pid_t
I'm using Django's post_save signal to send emails to users whenever a new article
My application is developped in C++ using Qt and is using signals and slots.
I am just using the admin site in Django. I have 2 Django signals
i need to make some kind of virtual keyboard, to send keyboard signals to

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.