On Sunday, 11 March 2012 18:27:33 UTC, hack wrote: > > How can I use an external URL in a django template? For example, I have a > CharField in the database/model and I want to display it on a template page > as an external link. However, when I do something like the following and > click the link: > <a href="{{items.website|urlencode}}">{{items.website}}</a> > > django attempts to access the link as follows: > http://localhost:8000/myapp/public/links/www.google.com > > instead of: > http://www.google.com > > Thanks. >
This has nothing whatsoever to do with Django or templates. If you put a link into an HTML page just as <a href="www.google.com">, rather than <a href="http://www.google.com">, exactly the same thing will happen. The answer is not to do that. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Xl5Vlb9pFYgJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.