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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:52:56+00:00 2026-06-15T00:52:56+00:00

I have a Physical_therapy_order model and an Event model (an event has foreignkey to

  • 0

I have a Physical_therapy_order model and an Event model (an event has foreignkey to Physical_therapy_order). I have a view which allows a user to create a new event. It also has a form with 3 fields from the Physical_therapy_order model.

def PTEventCreateView(request, pt_pk):
    #get the pt order and create an a form for that order
    pt_order = get_object_or_404(Physical_therapy_order, pk=pt_pk)
    ptform = PT_schedule_form(instance=pt_order)

    if request.POST:
        eventform = PTEventForm(data=request.POST)
        ptform = PT_schedule_form(data=request.POST, instance=pt_order)

        if eventform.is_valid() and ptform.is_valid():
            #I do some checks here that compare data across the two forms.
            # if everything looks good i mark keep_saving=True so I can 
            # continue to save all the data provided in the two forms
            if keep_saving:
                ptform.save()
                eventform.save()
            #...send user to succss page

This works just FINE EXCEPT: my PTEvent model has a function attached to its post_save signal. This function pulls the event’s related pt_order and makes some modifications to it. Now, if i save the eventform first then the changes from the signal don’t happen. if i save the ptform first the ptform changes get discarded and the changes from the signal happen.

THIS IS IMPORTANT: The ptform is editing three entirely different fields than the post_save signal. So its not like they’re modifying the same data, only the same model instance. I thought a form only saves the fields in its meta.fields attribute. Why would this be happening? Also, if i save the ptform first, then when eventsform is saved shouldn’t the signal use the updated physical_therapy_order? I’m not sure if I’m even on the right track?

  • 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-15T00:52:57+00:00Added an answer on June 15, 2026 at 12:52 am

    I think this is because of cached objects.

    What I would suggest is

    • Save eventform first
    • Get new instance of pt_order either querying db or through saved instance of eventform
    • And then re-create form and save.

    Sample code change:

    # your code
    if keep_saving:
        evt = eventform.save()
        # I'm not sure exact name of your field name for pt_order in Event model, change appropriately
        newptform = PT_schedule_form(data=request.POST, instance= evt.pt_order)
        newpt = newptform.save()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a Webapp which can read the user's Dropbox files. If
I have a web app which I can create some notes, each time I
I have a Droid X, which has a physical camera button. I am using
I have two processes which access to the same physical memory(GPIO data addr). So
I have written a function which reads an input buffer of bytes and produces
I have a physical memory address, which driver provide me through ioctl. How can
I have developed an iPad app which is currently in the testing phase. I
I have a task to create a program, that control a device over RS-232
I have a Java background, and am new to Ruby on Rails, and have
I have multiple user account types, each with different information. For example, business contacts

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.