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

The Archive Base Latest Questions

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

I try to implement search mechanism in Django but I couldn’t figure out what

  • 0

I try to implement search mechanism in Django but I couldn’t figure out what is the best way to do it.

I have a combobox and a textbox as seacrh parameters. There are two options in combobox like “A” and “B” and depending on that option different views should be run.

However, because there is a common properties of these two options, such as min-max length of textbox and soon on, I consider when search button clicked, it should go to some common search view and after the textbox is validated,or not, depending on the option in the combobox proper page should be redirected to proper page with the request given.

main/views.py

def search(request):
if request.method == 'POST':
    type = request.POST['searchType']
    searchvalue = request.POST['searchvalue']
    if len(searchvalue) > 200:
        return render_response(request, 'search/error.html', {'message':'bidi'})

    if type == 'A':
        return redirect('/A/search/')
    elif type == 'B':
        return redirect('/B/search/')
    else:
        return render_response(request, 'search/error.html', {'message':'errormessa'})

A/views.py

def search(request):
... 

B/views.py

def search(request):
... 

However, as you see, while I redirect to view A or view B I need to pass searchvalue as a post paramater but I couldn’t do.

Besides, I wonder is my structure proper and secure way to do such search ? What is the best approach to implement such search ?

Thanks

  • 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-23T18:40:07+00:00Added an answer on May 23, 2026 at 6:40 pm

    If you know javascript, do the search(form submit?) from javascript; so basically you check what the user has chosen and suitably chose the endpoint.

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

Sidebar

Related Questions

I'm dig into solr configuration stuff and try to figure out how implement autocomplete
I try to implement footer datagrid with allowMultipleSelection properties. But in my case, it
I had try to implement the send me log feature into my apps but
I tried to implement fixed position header bar. But when I try to resize
I am trying to implement pagination in my search results with Yii. I have
I am trying to implement UISearch bar but I have some problems. When app
I'm try to implement a user search on top of my working Smack-API based
I'm trying to implement search to my django based website. While following the tutorial
I'm trying to implement a binary search tree class, but the compiler is throwing
I try to implement the animation: when you enter iPhone Gallery, press the image,

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.