I have uploaded some files in django admin using
File = models.FileField(upload_to='./list/')
Now I want to download the same file for which I have written the below function within the class :
def file_link(self):
request = None
full_url = ''.join(['http://', get_current_site(request).domain, self.cvFile.url])
if self.cvFile:
return "<a href='%s'>download</a>" % (full_url)
else:
return "No attachment"
file_link.allow_tags = True
However when I click on the link, it redirects to a page with the link appended to the present url. And since the url doesn't exist, it is showing error.