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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:29:24+00:00 2026-05-28T04:29:24+00:00

I’ve built a Django form that submits to a page on another domain (that

  • 0

I’ve built a Django form that submits to a page on another domain (that I don’t control). The idea is that I have a nicely styled, neatly generated form that fits neatly into my own site and takes the user elsewhere when it is submitted.

However,

  • If that other form changes the names of any of its fields, I need to change the names of the fields in my form and then change those names everywhere else in my application – since the name attr is coupled to the name of the property used for the field.
  • If the remote form uses silly names then my form object must also have properties with silly names which pollutes my application’s code.
  • Should those names happen to be reserved words in Python (e.g. from), then it is difficult or impossible to create a Django form object representation.

Is there a way to specify a different string to use for the ‘name’ attribute when the field is displayed? Thus, decoupling the HTML form from the class that represents it.

This would need two components:

  1. Override the name value in the widget
  2. Make the form read this value from request.POST when it is bound

I only need step 1 in this case, but step 2 is relevant to solve the problems I listed above more generally

  • 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-28T04:29:25+00:00Added an answer on May 28, 2026 at 4:29 am

    This is a pretty horrible abuse of the API, but there is a form method called add_prefix that is called to determine what the HTML name of each field should be, taking into account the form’s prefix if any. You could override that so that it looks up the field name in a dictionary somewhere and returns the name you want – not forgetting to preserve the existing prefix behaviour:

    FIELD_NAME_MAPPING = {
        'field1': 'html_field1',
        'field2': 'html_field2'
    }
    
    class MyForm(forms.ModelForm):
        def add_prefix(self, field_name):
            # look up field name; return original if not found
            field_name = FIELD_NAME_MAPPING.get(field_name, field_name)
            return super(MyForm, self).add_prefix(field_name)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace

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.