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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:00:09+00:00 2026-06-12T19:00:09+00:00

I am using for loop in my template and for different id of each

  • 0

I am using for loop in my template and for different id of each record i am using arrays

{% for item in product %}

<div class="register_div">


    <p><label for="id[{{ item.id }}]">{{ item.Name }} </label> <input type="text" name="custom[{{item.id}}]"/></p>

</div>

{% endfor %}

Now when in my views i want to save this data to my database.But firstly i checked that whether my array return something or not.So i just try print that as.

q = upload_form.data['custom[]']

or

 q = upload_form.data['custom']

but it gives me this error

"Key 'custom[]' **OR** key custom not found in <QueryDict: {u'custom[2]': [u's'], u'custom[1]': [u'a'], u'price': [u''], u'title': [u''], u'customatt': [u'', u''], u'csrfmiddlewaretoken': [u'up4Ipd5L13Efk14MI3ia2FRYScMwMJLz']}>"

but if i print this

q = upload_form.data['custom[1]']

then it display the value of array 1.

so please suggest me a better way to do this how i can display all values inside my array in views.py

  • 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-12T19:00:10+00:00Added an answer on June 12, 2026 at 7:00 pm

    As upload_form.data is a dictionary, the key ‘custom[]’ simply doesn’t exist. Try something like:

    custom_values = {}    
    for key, value in in upload_form.data.items():
        if key.startswith('custom'):
            custom_values[key]=value
    

    The dictionary custom_values holds now all your ‘custom’ form values.

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

Sidebar

Related Questions

I have loop in template: {% for item in items %} <div class=item> {{
I'm using a loop as below to render a label and editor for each
So I create multiple BackgroundWorkers using loop: foreach (var item in list) { worker
Using for loop in PHP can we have numbers associate with a variable name?
I'm using the template python daemon discussed here in two different scripts to launch
i've a problem when making a loop using a GridFS pictures: class VentesHandler(BaseHandler): @tornado.web.authenticated
I'm using The Loop in my own theme template to get the last three
How do I simplify this templated vector initializer loop using lambdas or some kind
I just designed a simple For Loop using window form application. I would like
How can I skip over a loop using pdb.set_trace() ? For example, pdb.set_trace() for

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.