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

Ask A Question

Stats

  • Questions 254k
  • Answers 254k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You're on the right track if you are using NSZombie.… May 13, 2026 at 10:05 am
  • Editorial Team
    Editorial Team added an answer Spring has a comprehensive task execution framework. See the relevant… May 13, 2026 at 10:05 am
  • Editorial Team
    Editorial Team added an answer You can also specify -g3 in you compilation options so… May 13, 2026 at 10:05 am

Related Questions

Q: Is it possible to pull out the value for one of my ModelForm's
IIS7 supports this by using <system.webServer> configuration element to set module's preCondition=managedHandler attribute. Since
Is it possible to see definition of Q_SIGNALS, Q_SLOT, SLOT(), SIGNAL() macros in Qt
Is it possible to use If Else conditional in a LINQ query? Something like
Is it possible to use a function import in a where clause in entity

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.