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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:09:21+00:00 2026-05-13T13:09:21+00:00

This application returns schoolmates of lawyers . When a user searches for first name

  • 0

This application returns schoolmates of lawyers.

When a user searches for first name only and there are more than 1 result I leave the query in the form and ask them to enter a last name. But I thought that it would be nicer if the user just clicks to one of the names and search results are returned directly. (at this point the link takes you to search form again.)

In the template the query and the last name that I need are inside the {% for lawyer in lawyers %} loop as attributes: lawyer.first and lawyer.last. I couldn’t figure out how to save them to create a query. Can you help me with how to solve this problem?

Note: The template is below but I put the view function in pastebin.com. It’s 60 lines long, I wasn’t sure if I should be posting it here.

Thank you.

<html>
<head>
    <title>Search results</title>
</head>
<body>

 <p>You searched for <strong>{{ first|capfirst }} </strong>.</p>

<p>There are {{ lawyers|length }} {{ first|capfirst }} in the database. Please select one.</p>

{% for lawyer in lawyers %}
    <ul><li><a href="/search/">{{ lawyer.first }} {{ lawyer.last }} {{ lawyer.firm_name }} {{ lawyer.school}} class of {{ lawyer.year_graduated }}</a></li></ul>
{% endfor %}

<form action="" method="get">
{{ form.as_p }}
<input type="submit" value="Submit">
    </form>
</body>
</html>

Edit

Do I need to create a new view function like this?

def new_query(request):
    last_name = request.GET.get('lawyers.last')
    first_name = request.GET.get('lawyer.first')
    ....
  • 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-13T13:09:22+00:00Added an answer on May 13, 2026 at 1:09 pm

    Since you are using GET for your form, you can completely emulate a form submission with a normal link.

    <a href="?first_name={{lawyer.first}}&last_name={{lawyer.last}">
    

    this will send a request to the current URL (because we’re not specifying any URL, just GET parameters. this is the equivalent of

    <form action="" method="get">
    

    but adding to the form 2 parameters, called first_name, and last_name, just as they are called in your normal form – this way the same view can handle this request.

    If however you have additional parameters in your form (like year_of_graduation), you’ll have to add them too.

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

Sidebar

Related Questions

When I deployed my application on the server I faced this issue: Request.Url.ToString(); returns
I'm writing a WPF application that uses a component, and this component returns a
I am consuming a webservice using my java web application.This returns a number of
this Application.EventManager.on('Click', function(args) { // event listener, args is JSON TestAction.getContents(args.node.id, function(result, e) {
I have developed a Java EE web application. This application allows a user to
(Sorry for my english) First: I have an application created using C++ (this is
I have standard ASP.NET 4 application. Inside this application there are also few razor
This application is using windows integrated authentication in IIS. No anonymous login. It's also
My application structure is like this: application modules default student controllers forms studentParent.php models
I have this application where I implement the ActionBar Fragment interface. Underlying the interface,

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.