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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:33:39+00:00 2026-06-07T21:33:39+00:00

I have been looking at the documentation and thought maybe inline-formsets would be the

  • 0

I have been looking at the documentation and thought maybe inline-formsets would be the answer. But I am not entirely sure.

Usually whenever you create a ModelForm it is bound to the related Model only. But what if you wanted to edit two models within a form?

In a nutshell, when editing the class conversation, and selecting a Deal class from the dropdown, I would like to be able to change the status of the selected deal class as well (but not the deal_name). All within the same form. Does Django allow that?

class Deal(models.Model):    
    deal_name           = models.CharField()
    status              = models.ForeignKey(DealStatus)

class Conversation(models.Model):
    subject             = models.CharField()
    deal                = models.ForeignKey(Deal, blank=True, null=True)

Update:

The reason I wasn’t sure if inline-formssets are the answer is the following behaviour:

View:

call = get_object_or_404(contact.conversation_set.all(), pk=call_id)
ConversationFormSet = inlineformset_factory(Deal, Conversation)
fset = ConversationFormSet(instance=call)    
variables = RequestContext(request, {'formset':fset})
return render_to_response('conversation.html', variables)

Template

{{ formset }}  

The result I am getting is not what I expected. I am getting three forms of Conversation class, where the first one is filled out (due editing and passing in the isntance). However the Deal DropDown menu is not listed at all. Why?

  • 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-07T21:33:43+00:00Added an answer on June 7, 2026 at 9:33 pm

    I found the solution and hope this will help someone else with the same problem in the future. I ended up redesigning my models.

    I simply added the status also to my Conversation model.

    class Conversation(models.Model):
        subject             = models.CharField()
        deal                = models.ForeignKey(Deal, blank=True, null=True)
        status              = models.ForeignKey(DealStatus)
    

    In the view I added a custom save like this:

    if form.is_valid():            
                call = form.save(commit=False)
                deal =  get_object_or_404(Deal.objects.all(), pk=call.deal.id)
                deal.status = call.status
                deal.save()
                call.save()  
    

    That works nicely.

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

Sidebar

Related Questions

I have been looking through ths hashlib documentation but haven't found anything talking about
I have been looking around for an answer to this, but couldn't really find
I have been looking at the documentation on django nonrel but think i have
I am interested in using a DataObject and have been looking through the documentation.
Have been looking on some tutorials for drawing canvas using SurfaceView, but the only
I have been looking around ocn Google and Stackoverflow but haven't found what I
I have been looking into Node.JS and all the documentation and blogs talk about
I have been looking over the web for this but I can't seem to
I have been looking around for documentation on how journalling is implemented in ext3
I have been looking at how to use an NSColorWell in my app, but

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.