Create a hyperlink to external website in django

Viewed 2435

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.

3 Answers

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

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

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> 
Related