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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:40:02+00:00 2026-06-07T18:40:02+00:00

I have declared the following form form = BudgetPageInitial() in my view.py , what

  • 0

I have declared the following form

form = BudgetPageInitial()

in my view.py, what I want is to pass on a variable(say ‘x’) into the BudgetPageInitial(), so that I can use that variable in the forms definition in forms.py to generate ‘x’ number of input fields int he form BudgetPageInitial.

Please guide me 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-06-07T18:40:04+00:00Added an answer on June 7, 2026 at 6:40 pm

    View

    form = MiscQuestionForm(request.POST or None, misc=misc_questions)
    

    Form

    class MiscQuestionForm(BootstrapForm):
    
        def __init__(self, *args, **kwargs):
            misc = kwargs.pop('misc')
            super(MiscQuestionForm, self).__init__(*args, **kwargs)
    
            for question in misc:
                if question.answer_type == 1:  # bool
                    self.fields['custom_%s' % question.pk] = forms.BooleanField(
                            label=question, required=True)
                else:  # textfield
                    self.fields['custom_%s' % question.pk] = forms.CharField(
                            label=question, widget=forms.Textarea,
                            required=True)
    

    This is the design pattern you can use to pass variables to your form definition as I have with misc.

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

Sidebar

Related Questions

In following program . I have one doubt. I have declared one global variable
I have a project that requires the following. Four arrays will be declared in
Using ARC, I have a declared property of the following form: @property (nonatomic, strong)
Currently in a simple form i have the following declared table in code: declare
I have declared the following type KEY = (IPv4, Integer) type TPSQ = TVar
I have declared the following struct: typedef struct _RECOGNITIONRESULT { int begin_time_ms, end_time_ms; char*
I have the declared a class in following way class A: def __init__(self, list_1,
I have the following template method declared in my interface: class IObjectFactory { public:
I have the following action declared in my struts.xml: <action path=/updateAccountInfo type=org.myCompany.UpdateAccountAction name=myAccountForm scope=session
I have the following code: public partial class Form1 : Form { public BindingList<Class>

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.