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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:49:24+00:00 2026-05-23T11:49:24+00:00

When a link is clicked ( Which is generated from a search result )

  • 0

When a link is clicked ( Which is generated from a search result ) , it should take the name/primary key of that particular data to a view . I have read through the documentation of URL dispatcher , but haven’t got a concrete idea of how to pass the primary key of a certain row of a table to another view .

Any help is much appreciated .

Till now I have done this .

def that_view ( request , num) 
---view code 

search is generating a particular Url . When I click on that , the primary key should pass to this that_view to be processed to view the data .

Is this the right way to do it , if yes how exactly should I modify my urls.py and also the template that generates the data search (i.e the url) .

You might ask me to read the documentation , again and again . But I did . No help . Any code snippet of any kind ( even a link to such, and not a link to the documentation ) would help .

This is my views .

def map_search(request):
     lcount = Open_Layers.objects.all()

     form = SearchForm()
     if request.method == 'POST': 
            form = SearchForm(request.POST) 
            if form.is_valid():
            data = form.cleaned_data
                    val=form.cleaned_data['LayerName']

            a=OsmLayers()
                        b=Open_Layers()
            c=Sdr_Layer()
                        data = []
            data1=[]
            data2=[]
            data3=[]
            data1 = OsmLayers.objects.filter(Layername__icontains=val)
            data2 = Open_Layers.objects.filter(Layer_name__icontains=val)
            data3 = Sdr_Layer.objects.filter(layer_name__icontains=val)
            data.append(data1)
            data.append(data2)
            data.append(data3)  

            return render_to_response('searchresult.html', {'data':data})



        else:
            form = SearchForm()
     else:
        return render_to_response('mapsearch.html', {'form':form})
  • 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-23T11:49:25+00:00Added an answer on May 23, 2026 at 11:49 am

    you just need to pass your “num” via the url.

    in your urls.py:

    (r'example_path/(?P<num>\w+)/$', that_view),
    

    then inside your view, you can use the num variable as long as you want
    check out https://docs.djangoproject.com/en/dev/topics/http/urls/ for more info on urls formatting and regular expressions

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

Sidebar

Related Questions

I have some jQuery code that highlights a link when clicked, and changes the
I have some code right now that executes when a link is clicked. The
I am trying to get it so that when a link is clicked in
Using CSS, when a link is clicked it brings up a hidden DIV that
Im trying to take a link either when clicked or hover over be able
I would like a jQuery function to know which link was clicked to call
i want to get a variable (which is set when a link is clicked)
I have an ajax generated search results page which shows all results just fine.
I'm building a quiz web application that is dynamically generated from a database on
I have a link which when clicked downloads a pdf file. Is there a

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.