Nazia Jahan Trisha
Nazia Jahan Trisha

Reputation: 31

ip address hyperlink in Django

In my Django template I am having some problem to hyperlink. The link is a dynamically generated IP (not a file location).

in views.py

def basestations(request, host_id):
 'ipaddr': basestation.mni_address
 some code 

return render_to_response('basestations.html', locals(), context_instance=RequestContext(request))

This variable holding the dynamically produced IP address from database and passes to front end in the variable name basestation.mni_address

In Django template, I want the basestation should be hyperlinked with the basestation.mni_address

<td><a href="{% url what should I write here? %}"><i
                                        class="icon-th-large"></i> {{ basestation.name }}</a></td>

e.g. basestation.name is also passed to front end dynamically. This basestation.name should be hyperlinked with the IP address, means while clicking on the name, user should be forwarded to a link as ex -'http://192.168.255.66'

Any help is much appreciated.

Upvotes: 0

Views: 229

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599956

You wouldn't use {% url %} at all. That's for generating links to other URLs within your Django app. You want to link to an IP address, so just put that value in directly:

<a href="{{ basestation.mni_address }}">

Upvotes: 1

Related Questions