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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:23:06+00:00 2026-05-12T19:23:06+00:00

Q: Is it possible to pull out the value for one of my ModelForm’s

  • 0

Q: Is it possible to pull out the value for one of my ModelForm’s fields while in the template? If so, how?

Background:
I have a search form that I’m using to allow users to filter down query results. And, the table of results, along with the form can, be exported to an Excel sheet. When the page is rendered w/ the new results, the input values of the search form are still persisted. However, they’re also still contained in the field object for each input field of the form. So, during the export to Excel, the search form’s values aren’t being grabbed because the value isn’t in a table cell of its own. So, I want to add a column after the field’s column that contains the field’s value (but not display this column).

I could parse the HTML string for the field and grab whatever’s in the value attribute, but I’d only do that as a last resort. So far, I’ve been able to access the data dictionary of my form and get the object of whichever field I want, but I haven’t figured out which method I can use to actually grab the field’s value.

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

    Since you’re trying to get this data from a filled out form, I think the easiest way would be to pass the forms .cleaned_data to the template and use that. Let’s say you have a form with fields name and specialty, it would look something like this:

    def my_view(request):
        form = my_form(request.GET)
        if form.is_valid():
            ... do search stuff ...
            search_query = form.cleaned_data
            return render_to_response('my_template.html', {'search_query': search_query, 'search_results': ...,}, ...)
    

    Then, in your template, you just pull out the values you want:

    <tr>
      <th>Name</th>
      <th>Specialty</td>
    </tr>
    <tr>
      <td>{{ search_query.name }}</td>
      <td>{{ search_query.specialty }}</th>
    </tr>
    

    Or however you format it for Excel.

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

Sidebar

Related Questions

I have a form that a user would fill out while creating a ticket
Is it possible to have git pull and git push in one git command?
Does anyone know if it's possible to loop through a template and pull out
i would like to ask if it is possible to forbid pull-out of the
Is it possible to pull a bunch of .jpg pictures form a local file
Is it possible to pull photos from the Flickr API based on a search
Is it possible to store more than one value and query the database and
I am looking to pull out the minimum value across three tables and then
I have the following possible strings that I need to turn into arrays so
So not sure if this is possible but I have a pretty complex form.

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.