how to get a link to an absolute hyperlink

32 views
Skip to first unread message

dk

unread,
Feb 13, 2015, 5:40:31 PM2/13/15
to django...@googlegroups.com
this is my template
I do have this address
and show a table where the second colum is a link to somewhere else,  the problem is when I click it lunch me to

as an example if one of my links in the table is pointing to google
o do get
instead of just
google

is there a tag or some magic in django to say  just send me here?

thanks  guys.


 <table border="1" style="width: 100%">
{% for i in lista %}
<tr>
{% for j in i %}
{% if forloop.counter == 4 %}
<td style="background-color:blue"> <a href={{ j }} target="_blank" >{{ j }}</a> </td>
{% else %}
<td>{{ j }}</td>

{% endif %}
{% endfor %}
</tr>

{% endfor %}

Daniel França

unread,
Feb 13, 2015, 5:46:44 PM2/13/15
to django...@googlegroups.com
How's the hyperlink saved in the column? If it's a relative one this is what is going to happen, to change that you need an absolute link, i.e: http://google.com
--
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/c6ccb7e1-e202-45cc-a458-02b6c9029eea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dk

unread,
Feb 13, 2015, 6:03:47 PM2/13/15
to django...@googlegroups.com
its just a string with an ip address and that's it. 

<td> <a href={{ j }}>{{ j }}</a> </td>
so at the end should be something like
<td> <a href=11.111.11.1111>   11.111.11.1111</a> </td>

instead I get the hole path of my url + /11.111.11.1111  
I just want to go to 11.111.11.1111

Vijay Khemlani

unread,
Feb 13, 2015, 6:09:15 PM2/13/15
to django...@googlegroups.com
Try adding "http://" at the start

Also, consider that the format is 111.111.111.111:1111 (the port is after a colon, not a dot)

dk

unread,
Feb 16, 2015, 11:17:20 AM2/16/15
to django...@googlegroups.com
doing the http at the front did work!  thanks.
Reply all
Reply to author
Forward
0 new messages