views:

299

answers:

2

Hello I am trying to retrieve the absolute path (starting with http://) while calling a FileField at the template.

How can I achieve this ?

ie: {{fl.uploadedfile}} -> returns relative path like media/uploads/ while I want http://www.blabla.com/media/uploads/

Cheers

A: 

Just found the answer: adding .url fixes this issue fixes it such as{{fl.uploadedfile.url}}

A: 

The Django File object provides several convenience functions/attributes, one of which is the URL associated with the file. In this case, as you pointed out, you're looking for the url attribute.

jds