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

  • Home
  • SEARCH
  • 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 8546119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:56:39+00:00 2026-06-11T12:56:39+00:00

In my Django app, I have a page.html that includes forms from multiple models

  • 0

In my Django app, I have a page.html that includes forms from multiple models like so:

# models.py
class OneModel(models.Model):
    foo = models.CharField(...)
    bar = models.CharField(...)

# forms.py
class OneForm(forms.ModelForm):
    class Meta:
        model = OneModel

On save, in addition to the POST data, I add a prefix to all the forms, for example:

form1 = OneForm(prefix=OneForm.Meta.model._meta.module_name)

Then, I send the POST request to be saved and send the next data to the __init__ form:

# views.py
form_data = {'foo': 'fo-fo-fo',    # from request.POST
             'bar': 'bar-bar-bar'} # -//-//-
form1 = OneForm(form_data)         # without prefix

Afterwards, when the template is being put together, I get input from the form with my data (fo-fo-fo, bar-bar-bar), but without the prefix in input names, which is not what I want.

But if I add the prefix in the __init__ part instead I get back the form without my data:

# views.py
form1 = OpenForm(prefix=OneForm.Meta.model._meta.module_name, form_data)

How can I get the results of the form with both the data I need and the prefix I added?

  • 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-11T12:56:41+00:00Added an answer on June 11, 2026 at 12:56 pm

    You don’t need to create form_data from request.POST. You can create the form instance as form1 = OneForm(request.POST, prefix=OneForm.Meta.model._meta.module_name).

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

Sidebar

Related Questions

I have a client that has an app built with django. On every page
I have a Django app that gets it's data completely from an external source
I have a django app with models as follows: A Question model An Answer
I have a Django app where multiple teams upload content that will be parsed.
I have a Django app that needs to pull the follower_count information from several
i have a Model for a user profile in my django app that has
I have a Django app that use a django-tagging. I need to port this
I have a django app that I made and have implemented a plist into
I have a Django app and I am trying to perform transactions over multiple
I have a django app that has / at the end of every URL

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.