killerbees
killerbees

Reputation: 209

Create a hyperlink to external website in django

I have a little problem about creating a hyperlink to an external website in django, for example in to the google.com I have in my html file something like :

Adres www: <a href="{{ det_wpisu.adres_www }}">{{ det_wpisu.adres_www }}</a> <br />

but the www address when I click showing me :

http://localhost:8000/detale/3/www.google.com

and returned the 404 page.

Upvotes: 4

Views: 3396

Answers (3)

hdy
hdy

Reputation: 1

It is easy to add the http:// string in your Django template. Instead of modifying the views and/or the database, try this...

<a href="http://{{ det_wpisu.adres_www }}">{{ det_wpisu.adres_www }}</a> 

Upvotes: 0

Omid Estaji
Omid Estaji

Reputation: 320

Consider embed solution with use http . So it will be like:

<a href="http://www.google.com">Text</a>

Upvotes: 3

nemesifier
nemesifier

Reputation: 8529

Ensure the variable det_wpisu.adres_www contains a full URL including https://, eg:

context = {'det_wpisu.adres_www': 'https://www.google.com'}

Upvotes: 5

Related Questions