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 6542933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:17:09+00:00 2026-05-25T11:17:09+00:00

I need to trigger a signal if and only if form field status is

  • 0

I need to trigger a signal if and only if form field “status” is updated. The signal works fine, but is being triggered regardless of any change submissions to the form.

Below is my save_model override from admin.py, for the OrderAdmin class:

def save_model(self, request, obj, form, change):
    if not change:
        if not request.user.is_superuser:
            obj.organization = request.user
    if Order().is_dirty():
        custom_signals.notify_status.send(sender=self, status=obj.status)  
    obj.save()  

Here is my model:

class Order(DirtyFieldsMixin, models.Model):

StatusOptions = (
  ('Pending Confirmation', 'Pending Confirmation'),
  ('Confirmed', 'Confirmed'),
  ('Modified', 'Modified'),
  ('Placed', 'Placed'),
  ('En Route', 'En Route'),
  ('Completed', 'Completed'),
  ('Cancelled', 'Cancelled'),
  )

organization = models.ForeignKey(User, related_name='orders', default=1, help_text='Only visible to admins.')
status = models.CharField(max_length=50, choices=StatusOptions, default=1, help_text='Only visible to admins.')
order_name = models.CharField(max_length=22, blank=True, help_text='Optional. Name this order for easy reference (example: Munchies)')
contact_person = models.ForeignKey(Contact, help_text='This person is in charge of the order. We may contact him/her regarding this order.')
delivery_date = models.DateField('delivery day', help_text='Please use YYYY-MM-DD format (example: 2011-11-25)')
  • 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-25T11:17:09+00:00Added an answer on May 25, 2026 at 11:17 am

    You can try overriding ModelAdmin.get_object to add a flag to your instance:

    def get_object(self, request, object_id):
        o = super(Order, self).get_object(request, object_id)
        if o:
            o._old_status = o.status
        return o
    

    Now you can use if o.status != o._old_status in save_model.

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

Sidebar

Related Questions

the tabs are working fine but I need to trigger the NEXT and PREV
I need to trigger a form submit event when any form value changes and
In my app I have need to trigger show some custom view when status
I need to write a trigger that rounds a value whenever it is inserted/updated
I need to trigger a click function assigned to a checkbox, but without actually
I need to trigger a MouseEvent mouseClicked on a JLabel (or any other component
I am using an upload plugin that works great. I need to trigger the
I often want to trigger a certain function just once, but I need to
I need a trigger that updates a table row field if one or more
I have 2 GestureRecognizers that when triggered at the same need to trigger an

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.