0

I have a table in django template.

My current url is /tmp/example/

Ans              No. of Yes           No. of No.        No of Noides.

50                  10                 20                 21 
Men                 3                  10                 10 
Female              7                  10                 11

So basically I am displaying the number by doing filter and using count() in the end. SO my problem is how can I make the numbers as link and pass it to other url .

so say I click No of no. (20) it takes me to '/tmp/' which gives me one more table of all the 20 list values.

I can pass the list of object id or something from the first url.

so say i have view

def someview(request):
 # ger all objects and find out the count 
 # retun_to_response() 

in url '/tmp/example/' is link to someview

and I want to define '/tmp/' which i got after clicking on the numberlink in the /tmp/example/ table.

so i can i do that.

1 Answer 1

1

You need to have another url pattern defined first to take you to the page you want for that result. And you also need to make sure you name that pattern: https://docs.djangoproject.com/en/1.3/topics/http/urls/#id2

Then in your template, you can create a link around each result that resolves to a url: https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#url

That url template tag will reverse the url pattern name, and the args you give it to produce the proper url.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.