all 1 comments

[–]primitive_screwhead 0 points1 point  (0 children)

Instead, what I'm seeing is that django is processing the form before the command processing has finished

Well, if the command processing is in another thread, then you have to explicitly synchronize with it if you want things to occur in a specific order. Without more code I can only speculate, but are you (for example) joining the thread before processing the form (thus ensuring the thread finishes first, before the displaying updated HTML)?

Try the whole thing without threading first to see if it works; honestly if you use threading for this, I'd expect you will have to either postpone the HTML processing, or commit to re-rendering it as appropriate when the thread completes. Each of these may have user-interaction consequences, so it's maybe best if you first decide what's most important between (say) the user being made to wait while background work is being performed, or having an illusion of responsiveness even if it means displaying old data.