Passing ahref link as a variable to a view

36 views
Skip to first unread message

judy wawira

unread,
Feb 9, 2014, 10:59:43 PM2/9/14
to django...@googlegroups.com
i have a django page that loads urls as such 

Please select server to create shredder job

http://s.com/ 
http://munene.com/ 
http://faith.com/ 
http://one.com/ 

when a user selects a href, it loads a new page x.
I want to pass the url link to the next page (as a variable that can be used to search for contents to load) and have been scratching my ears on how to do this with no success

my href is                         
<a href="/test/" value="{{ server }}" id ='server_url' _name='server_url'>{{ server }}</a> <br/>

I have tried request.POST (but my form id loaded as GET )
i also tried request.GET.get['server_url']


Any ideas?

François Schiettecatte

unread,
Feb 10, 2014, 10:04:49 AM2/10/14
to django...@googlegroups.com
Judy

Is this what you are looking for ?

<a href="/test/?server_url={{server_url}}>{{ server }}</a>

or

<a href="/test/?server_url={{server}}>{{ server }}</a>

You can then get the server url with request.GET.get('server_url')


Cheers

François
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/612e01f1-ed62-4be4-bf06-80da8be59c8d%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

signature.asc

judy wawira

unread,
Feb 10, 2014, 8:12:22 PM2/10/14
to django...@googlegroups.com
Yes .. Your the best . Thanks so much (saved me another 24 hours of headache and google search
Reply all
Reply to author
Forward
0 new messages