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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:31:28+00:00 2026-05-15T18:31:28+00:00

I have 2 models, say Model A and Model B, each one having certain

  • 0

I have 2 models, say Model A and Model B, each one having certain fields (a1,a2,a3) and (b1,b2,b3).
I ran the scaffold command to generate the controllers and views for the models.
Now,
What i want to do is: –

On the new page of model A, I want to add a button/ href lin to create a new B object.
When the user clicks the button, a div appears below which has a form for creating B object.
When the user clicks the submit button after filling in the details for model B object, the changes are saved to the DB directly.

NOTE : A and B are not related to each other.
Can someone suggest me a way to do so??

  • 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-15T18:31:28+00:00Added an answer on May 15, 2026 at 6:31 pm

    Take a look at the screencasts listed below from the incomparable Railscasts series if you haven’t already watched then. They pretty much cover all the basics of processing multiple models on a singe form

    • Nested Model Form Part 1
    • Nested Model Form Part 2

    To display a <div>‘s contents when a button/link is clicked can be easily done in Javascript with JQuery (for example). That is described in the examples here.

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

Sidebar

Related Questions

Let's say I have: object A, B, C each with corresponding models, views, and
So, say I have models like this: class Foo(Model): name = CharField(max_length=200) def latest_comment(self):
Let's say I have these models: class A(models.Model): name = models.CharField(max_length=32) b = models.ForeignKey(B,
Lets say we have following models. class User(db.Model): username=db.StringProperty() avatar=db.ReferenceProperty() class User(db.Model): username=db.StringProperty() avatar=db.StringProperty()
Lets say we have the following models: (simplified) class Collection(models.Model): slug = models.SlugField() class
I want to generate a list using my django model say I have these
I have several similar Models (ContactEmail, ContactLetter, ContactPostalcard). Each instance (record) in, say, ContactEmail,
Say I have two models in Django - an Actor and a Movie model
Say I have the following models: class Baz(models.Model): winning = models.CharField(max_length=100) class Bar(models.Model): baz
Let's say you have several models that contain fields for address, postal code, province/country,

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.