is the concept of my codes and perhaps you can help:
from django.core.files import File
some_file = open('bla/bla/bla/', "rw")
django_file = File(some_file)
t = loader.get_gemplate('somewhere/temp.html')
c = Context({'file':django_file})
return HttpResponse(t.render(c))
### in the template ####
<a href="file:///{{ django_file.url }}>download</a>
Should this be a proper way to do?
Kann
On May 26, 12:15 pm, Florian Apolloner <f.apollo...@gmail.com> wrote:
> Hi,
>
> file.url is what you are looking for (assuming MEDIA_URL is configured
> correctly)
>
> Cheers,
> Florian
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment